Compacting stacks and todays' newbie question

Dar Scott dsc at swcp.com
Wed Apr 17 09:28:01 EDT 2002


On Wednesday, April 17, 2002, at 06:59 AM, Michael Foy wrote:

> read  from file "fred.txt" until EOF

This will read the entire file.

If you think you know what to do if the file is in a variable and 
the file is not huge, then you can also use the URL keyword to 
bring in the entire file at once.

Suppose you don't read it in all at once.  How you proceed depends 
a lot on how your file is structured.  You might be able to get by 
with something like this:

repeat ...
   read from file "Foy.db" until foyDbRecordEnd
   check result for eof, worry about partial and break out of loop
   translate record into a form to put into field
   put that into field
end repeat

In general a lot depends on the file format.
Is it ascii or binary?
What is a record?
   Is a single line?  (See TD on linefeed on end-of-line.)
   Multiple lines?  What separates them?
Fixed length or variable length?
et c.

In Revolution, you can bring in a file that is in an arbitrary file 
format.  Some will take more work than others.

Dar Scott




More information about the use-livecode mailing list