INFILE$() reads a line of text from a file. For example, stringVar$=INFILE$(file) reads bytes from an open file into stringVar$ up to the next newline character, or the end of the file, whichever comes first. The newline character is not put in the string, but the file pointer is moved beyond it.
INFILE$() reads newline-terminated strings of the kind written by READ [filenumber], statements.
READ [ filenumber ], variable-list
The READ statement reads binary data from an open file into one or more variables. READ reads the number of bytes into each variable that is appropriate to the type of the variable. For example, one byte is read into UBYTE variables, whether they are simple variables or elements of arrays or composites. Since simple UBYTE variables are held as 32-bit or 64-bit values, READ reads a byte and converts it into the 32-bit or 64-bit value before storing it in the variable. The extra bits of unsigned variables are filled with zeros, while the extra bits of signed variables are filled with the most-significant bit of the value read from the file.
READ also reads data into strings, arrays, composites, and portions of composites. Bytes are read from the file to fill the variable or component, unless the end of file is reached first. For example, if abc$ contains six bytes, READ [n], abc$ will read six bytes from the file into abc$.
WRITE [ filenumber ], variable-list
The WRITE statement writes binary data from one or more variables to file filenumber. WRITE writes the number of bytes appropriate to the type of the variable. For example, one byte is written for UBYTE variables, whether they are simple variables or elements of arrays or composites. Though simple UBYTE variables are held as 32-bit or 64-bit values, WRITE writes only the least significant byte. This has the effect of clipping off any higher bits that may exist. Where adverse effects are possible when reading back out-of-range values, programs should range check the values with type-conversion intrinsics before writing the variables to disk.
WRITE also writes strings, arrays, composites, and components of composites. All bytes in the variable, array, composite, or component are written to the file.