Download Dynamic C Function Reference Manual
Transcript
fwrite (FS2) int fwrite( File * f, void * buf, int len ); DESCRIPTION Write data to file opened for writing. The data is written starting at the current position. This is zero (start of file) when it is opened or created, but may be changed by fread(), fwrite(), fshift() or fseek() functions. After writing the data, the current position is advanced to the position just after the last byte written. Thus, sequential calls to fwrite() will add or append data contiguously. Unlike the previous file system (FILESYSTEM.LIB), this library allows files to be overwritten not just appended. Internally, overwrite and append are different operations with differing performance, depending on the underlying hardware. Generally, appending is more efficient especially with byte-writable flash memory. If the application allows, it is preferable to use append/shift rather than overwrite. In order to ensure that data is appended, use fseek(f, 0, SEEK_END) before calling fwrite(). The same current-position pointer is used for both read and write. If interspersing read and write, then fseek() should be used to ensure the correct position for each operation. Alternatively, the same file can be opened twice, with one descriptor used for read and the other for write. This precludes use of fshift(), since it does not tolerate shared files. PARAMETERS f Pointer to file descriptor (initialized by fopen_wr() or fcreate()). buf Data buffer located in root data memory or stack. len Length of data (0 to 32767 inclusive). RETURN VALUE len: Success. <len: Partial success. Returns amount successfully written. errno gives details. 0: Failure, or len was zero. ERRNO VALUES EBADFD - File descriptor not opened, or is read-only. EINVAL - len less than zero. 0 - Success, but len was zero. EIO - I/O error. ENOSPC - extent out of space. LIBRARY fs2.LIB SEE ALSO fread (FS2) 174 rabbit.com Dynamic C Functions
Related documents
PDF Version
UVIC CSC MATLAB Manual - Department of Computer Science
EMA3D v3.3.0 Installation Guide for linux64 - ema
µC/OS-III for the Freescale Kinetis - Doc
Multimedia Processor for Mobile Applications (EMMA
TCP/IP User`s Manual, Vol. 3
Automated Verification of the FreeRTOS Scheduler in HIP
Embedded Filesystems Library - 0.3
RN1723 Data Sheet
repair parts catalog for sunnen® computerized vertical honing
Dynamic C User`s Manual
EMMA Mobile1 Application Note Camera Interface