Keil Logo

_sys_read()

4.45 _sys_read()

Defined in rt_sys.h, the _sys_read() function reads the contents of a file into a buffer.

Syntax

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.

Returns

The return value is one of the following:
  • The number of bytes not read (that is, len minus the number of bytes that 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.
Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.