_sys_read()

Defined in rt_sys.h, this function reads the contents of a file into a buffer.

Show/hideSyntax

int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode);

Note

The mode parameter is here for historical reasons. It contains nothing useful and must be ignored.

Show/hideReturns

The return value is one of the following:

  • The number of bytes not read (that is, len - result number of bytes were read).

  • An error indication.

  • An EOF indicator. The EOF indication involves the setting of 0x80000000 in the normal result.

Reading up to and including the last byte of data does not turn on the EOF indicator. The EOF indicator is only reached when an attempt is made to read beyond the last byte of data. The target-independent code is capable of handling:

  • the EOF indicator being returned in the same read as the remaining bytes of data that precede the EOF

  • the EOF indicator being returned on its own after the remaining bytes of data have been returned in a previous read.

Show/hideSee also

Reference

Using ARM® C and C++ Libraries and Floating-Point Support:

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0492E
Non-ConfidentialID071611