home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1190 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.5 KB

  1. Path: sparky!uunet!stanford.edu!agate!agate!adrianho
  2. From: adrianho@barkley.berkeley.edu (Adrian J Ho)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: insertion of non-formated strings
  5. Date: 13 Aug 92 13:38:14
  6. Organization: University of California, Berkeley
  7. Lines: 21
  8. Message-ID: <ADRIANHO.92Aug13133814@barkley.berkeley.edu>
  9. References: <1992Aug12.215321.2136@terminator.cc.umich.edu>
  10. NNTP-Posting-Host: barkley.berkeley.edu
  11. In-reply-to: normanb@citi.umich.edu's message of Wed, 12 Aug 1992 21:53:21 GMT
  12.  
  13. In article <1992Aug12.215321.2136@terminator.cc.umich.edu> normanb@citi.umich.edu (David R. Richardson) writes:
  14. >What is the proper way to operate on strings that might not
  15. >be well formatted -- strings that might contain quotations,
  16. >braces, spaces, etc.?
  17.  
  18. This question can be answered in several different ways, depending on
  19. the context.  In your case, you're trying to operate on lines returned
  20. by a separate executable; you should take advantage of open's command
  21. pipeline capability, like this:
  22.  
  23. set fp [open "|scan"]
  24. while {[gets $fp line] > -1} {
  25.     .frame.list insert end $line
  26. }
  27. close $fp
  28. --
  29. -----------------------------------------------------------------------------
  30. Adrian Ho, He With The Embarrassingly *Dead* Passion ** Phone: (510) 642-5563
  31. System Manager, CFD Lab, ME Dept, UC Berkeley * adrianho@barkley.berkeley.edu
  32. Maintainer, Tcl/Tk Contrib Archive ---- barkley.berkeley.edu [128.32.142.237]
  33.   Send all Tcl/Tk Archive-related stuff to tcl-archive@barkley.berkeley.edu
  34.