FWrite Function (ROM Call 0x3E7)

AMS 2.00 or higher files.h

unsigned short FWrite (const void *buffer, unsigned short bytesToWrite, FILES *fsPtr);

Write a specified number of bytes to a file.

FWrite writes bytesToWrite bytes of data from the buffer buffer to the output file associated with the FILES structure pointed to by fsPtr. The data written begins at the current file position. buffer is a pointer to any object.

FWrite returns one of the following values as enumerated in the FileStatusEnum enum:
FS_OKThe write was successful.
FS_ERRORThe file fsPtr is not opened in write mode.
FS_MEMORYOut of memory.

Note: Any error will cause the file status to be set to FS_ERROR so that multiple writes may be performed without checking the return status as long as an FStatus is done at the end to make sure all of the writes were successful.


Uses: FPutC


See also: FOpen, FPutC, FRead, FClose