Trying to read hex data from a file

In reply to ianmurph:

From the LRM:

21.3.4.3 Reading formatted data

The $fscanf system function can be used to format data as it is read from a file. For example:
integer code ;
code = $fscanf ( fd, format, args );

$fscanf reads from the files specified by the file descriptor fd.

The number of successfully matched and assigned input items is returned in code; this number can be 0 in the event of an early matching failure between an input character and the control string. If the input ends before the first matching failure or conversion, EOF (-1) is returned. Applications can call $ferror to determine the cause of the most recent error (see 21.3.7).