Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

end of file for windows file

Status
Not open for further replies.

rameshbhats

Technical User
Dec 7, 2010
8
GB
Hi,

I am using Etcl for Windows(Evolane Tcl/Tk Engine
Version 1.0.1 (2009-01-06), I am trying some filehandling programs, where I wanted to read a file until end of file.

I used: while ![eof $file] { gets $file }

But with this code, Etcl stops responding(windows hangs).

Please guide me on this.

Regards
Ramesh
 
Hi

Watch the syntax.

In Tcl everything is a string which gets evaluated. Unquoted and quoted string is evaluated on parse time. So your code is reduced to this long before executing it :
Code:
[b]while[/b] true [teal]{[/teal] [b]gets[/b] [navy]$file[/navy] [teal]}[/teal]
To avoid that, you must enclose the string in braces ( {} ) :
Code:
[b]while[/b] [highlight][teal]{[/teal][/highlight][teal]![[/teal][b]eof[/b] [navy]$file[/navy][teal]][/teal][highlight][teal]}[/teal][/highlight] [teal]{[/teal] [b]gets[/b] [navy]$file[/navy] [teal]}[/teal]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top