You can use the the \(\text{FileReadByte}\) function to read a single byte of data from a file.

You can use the \filereadbyte backslash command to insert this function.

The following variants of this function are available:

  • \(\text{tuple } \text{FileReadByte} \left ( \text{<file number>} \right )\)

The \(\text{<file number>}\) parameter is an integer value returned by one of the \(\text{FileOpen}\ldots\) functions. The returned tuple will contain two entries:

  • An integer holding the received byte. The value will be over the range \([0, 255]\). The value -1 will be reported on error.

  • A boolean holding true on success or false on error.

The Figure 137 shows how you can use the \(\text{FileReadByte}\) function.