<< Previous | Next >>

fat_Write

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

Description

Writes characters into the file specified by the file pointer beginning at the current position in the file. Characters will be copied from the string pointed to by buf. The len variable controls how many characters will be written. This can be more than one sector in length, and the write function will allocate additional sectors if needed. Data is written into the file starting at the current file position regardless of existing data. Overwriting at specific points in the file can be accomplished by calling the fat_Seek() function before calling fat_Write().

Parameters

file
Handle for the open file being written.

buf
Pointer to the buffer containing data to write.

len
Length of data to be written.

Return Value

Number of bytes written: success (may be less than len, or zero if non-blocking mode)
-EIO: device I/O error.
-EINVAL: file, buf, or len contain invalid values.
-ENOENT: file does not exist.
-ENOSPC: no space left on the device to complete the write.
-EFAULT: problem in file (broken cluster chain, etc.).
-EPERM: the file is locked or is write-protected.
-EBUSY: the device is busy (only if non-blocking).
-EFSTATE: file is in inappropriate state (only if non-blocking).

Library

FAT.LIB

See Also

fat_Open, fat_Read, fat_xWrite, fat_Seek


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