Func: Write.
Desc: Writes the specified number of bytes to the file.
Returns the number of bytes actually written to the file.