Defined in rt_sys.h, the
_sys_read() function reads the contents of a file into a buffer.
The mode parameter is here for historical reasons. It contains nothing useful and must be ignored.
The return value is one of the following:
The number of bytes not read (that is,
lenminus the number of bytes that were read).
An error indication.
EOFindication involves the setting of
0x80000000in the normal result.
Reading up to and including the last byte of data does not
turn on the
EOF indicator. The
is only reached when an attempt is made to read beyond the last
byte of data. The target-independent code is capable of handling:
EOFindicator being returned in the same read as the remaining bytes of data that precede the
EOFindicator being returned on its own after the remaining bytes of data have been returned in a previous read.