-
Notifications
You must be signed in to change notification settings - Fork 8
read
MicroBlaster edited this page Dec 11, 2020
·
3 revisions
Purpose: Reads a line of a text from a text file.
Syntax: read {file} storageVar {line}
{file}: The file to read text from.
storageVar: The variable to store the line in.
{line}: The line number to read.
Notes: This command attempts to read a line of text from a file. If the file does not exist, an error is raised. If the line is past the end of the file, 'EOF' is returned.
Example:
$BustFile := GAMEDATA & "busts.txt"
if ($BustFile <> "") fileExists $exists $BustFile
if ($exists) setArray $BustList SECTORS setVar $i 1 read $BustFile $bust $i while ($bust <> EOF) setVar $BustList[$bust] 1 add $i 1 read $BustFile $bust $i end end end
.