home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / tcl / 1779 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.5 KB  |  47 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!ukma!darwin.sura.net!zaphod.mps.ohio-state.edu!uunet.ca!unilabs!chare
  3. From: chare@unilabs.uucp (Chris Hare)
  4. Subject: new user questions
  5. Message-ID: <1992Nov10.133434.26583@unilabs.uucp>
  6. Organization: UniLabs Research Group
  7. Date: Tue, 10 Nov 1992 13:34:34 GMT
  8. Lines: 37
  9.  
  10. Tcl6.4
  11. Tk2.3
  12. SCO UNIX 3.2v4
  13.  
  14. Well, I'm missing something somewhere.  Consider this code extract:
  15.  
  16. catch { set fd [ open "$CategoryList" "r" ] } ok
  17. puts stdout "fd = $fd"
  18. set end { eof fd }
  19. puts stdout "eof = $end"
  20. while { $end == 0 } {
  21.    set record { gets $fd }
  22.    puts stdout "have $record"
  23.    #
  24.    # define the list
  25.    #
  26.    .left.list insert end $record
  27.    set end { eof $fd }
  28. puts stdout "eof = $end"
  29. }
  30.  
  31. What I want to acheive is to fill a list box with the contents of a file.
  32. The open and catch work OK (although I want to add code to test for failure
  33. and show a dialog box ), but the problem specifically is with the call to
  34. eof.  The puts after the call to eof says the variable end contains the
  35. text "eof fd".  How do I do this properly?
  36.  
  37. In addition, is there a tcl command like split it perl?  I have in anotehr
  38. file which will be processed the text for the list box, and then a keyword
  39. which specifies the name of the file which is to be opened.  This
  40. information separated by colons.
  41.  
  42. Thanks!
  43. -- 
  44. ????                --- It Always works for me! ---                           
  45. Chris Hare, UNIX Scientist                  Preferred : chare@unilabs.org
  46. Just a mild-mannered consultant by day ....
  47.