4.10.5. _sys_read()

This function reads the contents of a file into a buffer.


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


The mode argument is abitmap describing the state of the file connected to fh, as for _sys_write().


The return value is one of the following:

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

  • An error indication.

  • An EOF indicator. The EOF indication involves the setting of 0x80000000 in the normal result. The target-independent code is capable of handling either:

    Early EOF

    The last read from a file returns some characters plus an EOF indicator.

    Late EOF

    The last read returns only EOF.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D