FSfwrite Function

Microchip MDD File System Interface

MDDFS Interface Library Help
FSfwrite Function
C
size_t FSfwrite(
    const void * ptr, 
    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 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.

Preconditions

File opened in WRITE, APPEND, WRITE+, APPEND+, READ+ mode

Parameters
Parameters 
Description 
ptr 
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.2.0 - [Aug 18, 2008]
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.