[Main]
Name=FWrite
Type=Function
Subtype=ROM Call
Header Files=files.h
Definition=unsigned short FWrite (const void *buffer, unsigned short bytesToWrite, FILES *fsPtr);
MinAMS=2.00
See Also=files.h/TIOS_FOpen: FOpen, files.h/TIOS_FPutC: FPutC, files.h/TIOS_FRead: FRead, files.h/TIOS_FClose: FClose

[ROM Call]
Index=$3E7

[Description]
Write a specified number of bytes to a file.

[Explanation]
FWrite writes <I>bytesToWrite</I> bytes of data from the buffer <I>buffer</I> to the output file associated with the <A HREF="$$LINK(files.h/FILES)">FILES</A> structure pointed to by <I>fsPtr</I>. 
The data written begins at the current file position. <I>buffer</I> is a pointer to any object.
<BR><BR>
FWrite returns one of the following values as enumerated in the <A HREF="$$LINK(files.h/FileStatusEnum)">FileStatusEnum</A> enum:
<TABLE BORDER CELLPADDING="3">
<TR>
<TD>FS_OK</TD><TD>The write was successful.</TD>
</TR>
<TR>
<TD>FS_ERROR</TD><TD>The file <I>fsPtr</I> is not opened in write mode.</TD>
</TR>
<TR>
<TD>FS_MEMORY</TD><TD>Out of memory.</TD>
</TR>
</TABLE>
<BR>
<B>Note:</B> Any error will cause the file status to be set to <A HREF="$$LINK(files.h/FileStatusEnum)">FS_ERROR</A> so that multiple
writes may be performed without checking the return status as long as an
<A HREF="$$LINK(files.h/TIOS_FStatus)">FStatus</A> is done at the end to make sure all of the writes were successful.

[References]
Out=files.h/TIOS_FPutC: FPutC
