[index]
Read From File Command
Syntax
read from file <filename> until <character>
read from file <filename> for <integer>
Description
The read from file command imports text or data handled as text from a text file until a specific character is located or until <integer> characters have been imported. The imported text is put into the variable it. Executing an open file command sets the read from file position to the beginning of the file. The read from file command reads the file until the end of file is reached.
If you execute several read from file commands, i.e.:
open file fname
read from file fname until return
then the the first read from file command reads the fist line of the file. The second read from file command reads the second line of the file.
Notes
To read a line of a text file whose lines are delimited by carriage returns, use the following syntax:
read from file <filename> until return
To read a file until the end of file is reached, you can use the following syntax: read from file fname until EOF
Examples
This example reads an ASCII file called "Test". To try it, you must have an appropriate file available. Create a field named "File Info". Create a button named "Get Info" with the following script:
on mouseUp
with "Test.txt"
put it into fname
open file fname
read from file fname for 100 put it into fld "File Info" close file fname
end mouseUp
This text has been mechanically extracted from the Oracle Media Objects 1.0.4.9 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.