SPRUI04F july 2015 – april 2023
Read Characters from a File
int DEV_read (int dev_fd , char * buf , unsigned count );
The read function reads count bytes from the input file associated with dev_fd.
This function must return -1 to indicate an error if for some reason no bytes could be read from the file. This could be because of an attempt to read from a O_WRONLY file, or for device-specific reasons.
If count is 0, no bytes are read and this function returns 0.
This function returns the number of bytes read, from 0 to count. 0 indicates that EOF was reached before any bytes were read. It is not an error to read less than count bytes; this is common if the are not enough bytes left in the file or the request was larger than an internal device buffer size.