Version 8 of Answered Questions On: File & Socket I/O

Updated 2004-10-28 16:24:07


NAVIGATION


TABLE OF CONTENTS (File & Socket I/O):

  • I'm Having Trouble With The Fconfigure Command. What's The Correct Syntax?
  • How Do I Generate Filenames That Include The Current Date/Time?

I'm Having Trouble With The Fconfigure Command. What's The Correct Syntax?

I am trying to read a file and open it using the browsers mime type. I use the following piece of code to open the file.

    set fIn [ open $sFileName r ]
    fconfigure $fIn TestName.xxx -translation { binary binary }
    puts [ read $fIn $iContentLength ]
    close $fIn

things are working fine. The only annoying thing is that each time i try to open a file by clicking a hyperlink, it shows me a annoying save as window which i want to get rid of ..

Would appreciate any help here.

Thank you, Ashish

Peter Newman 2 April 2004: The "Testname.xxx" on your "fconfigure" line looks like an error to me. Get rid of it. But whether that's the cause of your problem I don't know. I don't really understand what you're trying to do. You'll need to give more details.


How Do I Generate Filenames That Include The Current Date/Time?

02/09/2004

Hello, can somebody tell me how I should generate a filename automatically. I want to use the date of that excact moment and the first three letters of a predefined string.

I hope somebody can help e with this.

GrtZ,

Theo

NEM Try:

 set filename [string range $predefined 0 2][clock seconds]

where $predefined is the string you mention. If you want the date in a more readable format, then look at [clock format].