reading from a file

Dennis Brown see3d at writeme.com
Mon Jun 13 08:50:53 EDT 2005


On Jun 13, 2005, at 2:39 AM, John Ridge wrote:

> Thanks, Dennis. That looks very interesting. I'm trying to build a  
> stack "on
> the fly", reading in a number of text fields for each card - they may
> contain return, eol etc characters, so I must write out my own  
> delimiters
> when I export the card contents. What you've suggested is that I  
> need two
> delimiters - a "line" delimiter to mark the end of a card, and an  
> "item"
> delimiter to separate the fields. Then I can try your double "for  
> each"
> approach - I'll let you know.


John,

You can also do this with a single repeat for each.

repeat for each char thisCharacter in wholeFileVariable
     doSomethingWith thisCharacter
end repeat

See the example stack called read anything in RevOnline to see how it  
is done.  If you can scan your file sequentially, you can do anything  
you want to it in short order.  It just depends on the specific  
details you want to accomplish.

Dennis


More information about the use-livecode mailing list