Original Author Paul Laughton, 2011
Page 113
De Re BASIC!
PRINT Byte
UNTIL Byte < 0
BYTE.CLOSE file_number
Byte.write.byte <file_table_nexp> {{,<nexp>}...{,<sexp>}}
Writes bytes to the file specified by the file number parameter <file_table_nexp>. The bytes are written
from an optional comma-separated list of numeric expressions, a single optional string expression, or
both.
Numeric parameters: the command writes the low-order 8 bits of the value of each expression as a
single byte.
String parameters: the command writes the entire string to the file. Each character of the string is
written as a single byte. See Byte.write.buffer for more information.
If you have both numeric and string parameters, you may have only one string, and it must be last.
The command accepts a string for backward compatibility. Byte.write.buffer is preferred.
Examples:
Byte.open w, f1, "tmp.dat"
% create a file
Byte.write.byte f1, 10
% write one byte
Byte.write.byte f1, 11, 12, 13
% write three bytes
Byte.write.byte f1, "Hello!"
% write six bytes
Byte.write.byte f1, 1,2,3,"abc"
% write six bytes
Byte.write.byte f1, "one", "two"
% syntax error: only one string allowed
Note: If the bytes are written from a string expression then the expression is evaluated twice. You
should not put calls to user-defined functions in the expression.
Byte.read.number <file_table_nexp> {,<nvar>...}
Reads numbers from the file specified by the file number parameter <file_table_nexp> and places them
into the numeric variables in the "{,<nvar>}..." parameter list. Each number is a group of 8 bytes.
If the file does not have enough data available for all of the variables, the value of one or more <nvar>
will be set to -1. This is indistinguishable from -1 read as actual data, except that the result of the
Byte.eof command will be false for real data and true for EOF.
Normally this command is used only to read values written with Byte.write.number. You must be sure
the file is positioned at the first byte of the eight-byte representation of a number, or you will get
unexpected results.
Byte.write.number <file_table_nexp> {,<nexp>}...
Writes the values of the numeric expressions <nexp> to the file specified by the file number parameter
<file_table_nexp>. This command always writes 8 bytes for each expression in the parameter list.