<< Previous | Next >> | |
|
int fat_Read( FATfile *file, char *buf, int len );
Description
- Given
file
,buf
, andlen
, this routine readslen
characters from the specified file and places the characters intobuf
. The function returns the number of characters actually read on success. Characters are 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 changed by thefat_Seek()
function. If the file contains fewer thanlen
characters from the current position to the EOF, the transfer will stop at the EOF. If already at the EOF, 0 is returned. Thelen
parameter must be positive, limiting reads to 32767 bytes per call.Parameters
- file
- Handle for the file being read.
- buf
- Pointer to the buffer where data are to be placed.
- len
- Length of data to be read.
Return Value
- Number of bytes read: success. May be less than the requested amount in non-blocking mode, or if EOF was encountered.
-EEOF
: starting position for read was at (or beyond) end-of-file.
-EIO
: device I/O error.
-EINVAL
:file
,buf
, orlen
, contain invalid values.
-EPERM
: the file is locked.
-ENOENT
: the file/directory does not exist.
-EFSTATE
: file is in inappropriate state (Only if non-blocking).Library
- FAT.LIB
See Also
- fat_Open, fat_Write, fat_Seek
Dynamic C Functions | << Previous | Next >> | rabbit.com |