Keil Logo

SYS_READ (0x06)

11.17 SYS_READ (0x06)

Reads the contents of a file into a buffer.

The file position is specified either:
  • explicitly by a SYS_SEEK
  • implicitly one byte beyond the previous SYS_READ or SYS_WRITE request.
The file position is at the start of the file when it is opened, and is lost when the file is closed. Perform the file operation as a single action whenever possible. For example, do not split a read of 16KB into four 4KB chunks unless there is no alternative.


On entry, R1 contains a pointer to a four-word data block:
word 1
contains a handle for a file previously opened with SYS_OPEN
word 2
points to a buffer
word 3
contains the number of bytes to read to the buffer from the file.


On exit:
  • R0 contains zero if the call is successful.
  • If R0 contains the same value as word 3, the call has failed and EOF is assumed.
  • If R0 contains a smaller value than word 3, the call was partially successful. No error is assumed, but the buffer has not been filled.
If the handle is for an interactive device, that is, SYS_ISTTY returns –1. A nonzero return from SYS_READ indicates that the line read did not fill the buffer.
Non-ConfidentialPDF file icon PDF versionARM DUI0375H
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.