fwrite() writes the contents of
string to the file stream pointed to by
handle. If the
argument is given, writing will stop after
length bytes have been written or the end
string is reached, whichever comes
fwrite() returns the number of bytes written, or FALSE on error.
Note that if the
length argument is given,
then the magic_quotes_runtime
configuration option will be ignored and no slashes will be
Note: On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter.
handlewas fopen()ed in append mode, fwrite()s are atomic (unless the size of
stringexceeds the filesystem's block size, on some platforms, and as long as the file is on a local filesystem). That is, there is no need to flock() a resource before calling fwrite(); all of the data will be written without interruption.
Example 1. A simple fwrite() example