<< Previous | Next >>

fat_Read

int fat_Read( FATfile *file, char *buf, int len );

Description

Given file, buf, and len, this routine reads len characters from the specified file and places the characters into buf. 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 the fat_Seek() function. If the file contains fewer than len characters from the current position to the EOF, the transfer will stop at the EOF. If already at the EOF, 0 is returned. The len 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, or len, 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