home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!think.com!ames!tulane!cpu.com!cpu.com!GWLESTER
- From: gwlester@cpu.com (Gerald W. Lester)
- Subject: Re: new user questions
- Nntp-Posting-Host: captainhook.cpu.com
- References: <1992Nov10.133434.26583@unilabs.uucp>
- Sender: usenet@cpu.com (Usenet administrator)
- Organization: Computerized Processes Unlimited, Metairie, LA, (504)-889-2784
- Date: Tue, 10 Nov 1992 18:39:33 GMT
- Message-ID: <1992Nov10.183933.10159@cpu.com>
- Reply-To: gwlester@cpu.com
- Lines: 45
-
- In article <1992Nov10.133434.26583@unilabs.uucp>, chare@unilabs.uucp (Chris Hare) writes:
- >Tcl6.4
- >Tk2.3
- >SCO UNIX 3.2v4
- >
- >Well, I'm missing something somewhere. Consider this code extract:
- >
- >catch { set fd [ open "$CategoryList" "r" ] } ok
- >puts stdout "fd = $fd"
- >set end { eof fd }
- >puts stdout "eof = $end"
- >while { $end == 0 } {
- > set record { gets $fd }
- > puts stdout "have $record"
- > #
- > # define the list
- > #
- > .left.list insert end $record
- > set end { eof $fd }
- >puts stdout "eof = $end"
- >}
- >
- >What I want to acheive is to fill a list box with the contents of a file.
- >The open and catch work OK (although I want to add code to test for failure
- >and show a dialog box ), but the problem specifically is with the call to
- >eof. The puts after the call to eof says the variable end contains the
- >text "eof fd". How do I do this properly?
-
- set end [eof $fd]
- >
- >In addition, is there a tcl command like split it perl? I have in anotehr
- >file which will be processed the text for the list box, and then a keyword
- >which specifies the name of the file which is to be opened. This
- >information separated by colons.
-
- split string ":"
- or if your string is in the variable foobar
- split $foobar ":"
-
- >
- >Thanks!
- >--
- >???? --- It Always works for me! ---
- >Chris Hare, UNIX Scientist Preferred : chare@unilabs.org
- >Just a mild-mannered consultant by day ....
-