size_t FSfwrite( const void * ptr, size_t size, size_t n, FSFILE * stream );
The FSfwrite function will write data to a file. First, the sector that corresponds to the current position in the file will be loaded (if it hasn't already been cached in the global data buffer). Data will then be written to the device from the specified buffer until the specified amount has been written. If the end of a cluster is reached, the next cluster will be loaded, unless the end-of-file flag for the specified file has been set. If it has, a new cluster will be allocated to the file. Finally, the new position and filezize will be stored in the FSFILE object. The parameters 'size' and 'n' indicate how much data to write. 'Size' refers to the size of one object to write (in bytes), and 'n' will refer to the number of these objects to write. The value returned will be equal to 'n' unless an error occured.
Parameters |
Description |
ptr |
Pointer to source buffer |
size |
Size of units in bytes |
n |
Number of units to transfer |
stream |
Pointer to file structure |
size_t - number of units written
The FSerrno variable will be changed.
None.