#READ (read one line of a source file) 

Top  Previous  Next

 

#READ( symbol )

#READ

Reads the next record from the opened read-only file.

symbol

The symbol to receive the text from the file.

The #READ statement reads the next record (up to the next CR/LF encountered) from open read-only file. The symbol receives the text from the file. If the last record has been read, the symbol will contain a value equivalent to the %EOF built-in symbol.

Example:

#OPEN(%ProgramFile),READ              #!Open it in read-only mode

#DECLARE(%ASCIIFileRecord)                

#LOOP

#READ(%ASCIIFileRecord)

#IF(%ASCIIFileRecord = %EOF)

 #BREAK

#ENDIF

#! Parse the line and do something with it

#ENDLOOP

#CLOSE(%ProgramFile),READ             #!Close the read-only file

 

See Also:     #OPEN ,#CLOSE