FSfwrite Function

MDD File System Interface Library

MDDFS Interface Library Help
FSfwrite Function
C
size_t FSfwrite(
    const void * data_to_write, 
    size_t size, 
    size_t n, 
    FSFILE * stream
);
Description

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 filesize 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.

Preconditions

File opened in FS_WRITE, FS_APPEND, FS_WRITE+, FS_APPEND+, FS_READ+ mode

Parameters
Parameters 
Description 
data_to_write 
Pointer to source buffer 
size 
Size of units in bytes 
Number of units to transfer 
stream 
Pointer to file structure 
Returns

size_t - number of units written

Side Effects

The FSerrno variable will be changed.

Remarks

None.

Microchip MDD File System Interface 1.4.2 - [Oct 15, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.