<< Previous | Next >>

fat_xRead

fat_xRead( FATfile * file, char far * buf, int len );

Description

Given file, buf and len, this routine reads len characters from the specified file and places the characters into string buf. Returns the number of characters actually read on success.

Characters will be read beginning at the current position of the file and the position pointer will be left pointing to the next byte to be read. The file position can be manually set with the fat_Seek() function. If the file contains less the "len" characters from the current position to the end of the file (EOF), then the transfer will stop at the EOF. If already at the EOF, -EEOF is returned. The len parameter must be positive, limiting reads to 32767 bytes per call.

µC/OS-II USERS:

Parameters

file
Handle for the file being read

buf
Pointer to buffer where data is to be placed. May be NULL in order to discard data

len
Length of data to be read. If this is zero, then the return code will be `1' if not at EOF, or `0' if at EOF.

Return Value

Number of bytes read on Success. May be less than the requested amount in non-blocking mode, or if EOF was encountered.

-EEOF: stating position for read was at (or beyond) EOF.
-EIO: on device IO error
-EINVAL: if file, buf, or len contain invalid values
-EPERM: if the file is locked
-ENOENT: if file/directory does not exist
-EFSTATE: if file in inappropriate state (non-blocking)

See Also

fat_Open, fat_Read, fat_Write, fat_xWrite, fat_Seek


Dynamic C Functions << Previous | Next >> rabbit.com