FILEWR statement
Writes to a file.
Syntax:
FILEWR <file number expression> <data expression>, <data expression>, …
One or more data expressions can be written (appended) to the file and are comma separated. A
data expression can be a string or a numeric expression. There is no comma after the <file
number expression> parameter. Each FILEWR command writes a line to the file, and the line is
terminated with a linefeed /n character (ASCII 10).
A file must have been correctly opened for writing prior to executing the FILEWR command, or it
will fail with a runtime error.
Examples:
FILE 1 “W” “EXAMPLE”
FILEWR 1 “HELLO”
opens a file “EXAMPLE” for writing as file number 1, and writes “HELLO” to it.
FILE 2 “W” “DATA3”
LET A = 1
LET B = 2
LET C = 3
FILEWR 2 A, B, C
opens a file named “DATA3” for writing as file number 2, and writes a line to it: “1,2,3”
FILERD statement
Reads from a file.
Syntax:
FILERD <file number expression> <variable>, <variable>, …
One or more variable names can be supplied and the system will attempt to read comma
separated data from the file, convert it to numbers, and set the corresponding variables. There is
no comma after the <file number expression> parameter.
A file must have been correctly opened for reading prior to executing the FILEWR command, or it
will fail with a runtime error.
Example:
FILE 1 “R” “DATA3”
FILERD 1 D, E, F
PRINT D, E, F
U4B operating manual Rev 1.00
47