![QRP Labs U4B Ultimate4 Operating Manual Download Page 48](http://html1.mh-extra.com/html/qrp-labs/u4b-ultimate4/u4b-ultimate4_operating-manual_3285244048.webp)
When the file DATA3 was created as per the FILEWR example in the previous section, this
example will open file “DATA3” for reading, and read its comma delimited contents into variables
D, E and F. The print statement will print these values to the terminal, appearing as:
1 2 3
Note that if your program needs to read all the data lines from a file in a loop, you can detect the
end of the file using the FILEEOF function described in a previous section. For example, if
“DATA3” contains multiple lines:
FILE 1 “R” “DATA3”
LET C = 0
10 IF FILEEOF 1 = 0
LET C = C + 1
FILERD 1 D, E, F
PRINT D, E, F
GOTO 10
ELSE
PRINT “FINISHED! READ #VC ROWS!”
ENDIF
This example opens file “DATA3” for reading. It then loops through, reading data lines from the
file, and parsing them into variables D, E and F, which it prints to the screen. It also keeps a line
counter in variable C. While it has not reached the end of the file, the program loops back via
GOTO 10 and repeats the read. When the end of the file is reached, the program prints
“FINISHED! READ 6 ROWS!” (for example, if there were 6 lines in the file.
You can also access the first 20 characters of a file line using the #FL tag in a string. For example,
if file DATA3 contains a single line “1,2,3” as in our above example:
FILE 1 “R” “DATA3”
FILERD 1
PRINT “#CS”
will display on the terminal
1,2,3
You can then use VAL “#CS” if you want to parse characters from the string, convert them to
numbers etc.
FILEDEL statement
Deletes a file entirely from the file system.
Syntax:
FILEDEL <filename string>
Example:
FILEDEL “TEST”
U4B operating manual Rev 1.00
48