Is there any way to test if writing to a file was successfully accomplished? I need a method to obtain the end of time of a writing operation. If so to trigger a callback function.
1 Answer
fwrite() returns the number of bytes written, or FALSE on error.
Check whether fwrite() returns false and you'll know that the write succeeded. Be careful to use the ===
comparison operator instead of the ==
operator when checking if the returned value is false.
You can use filemtime()
to get the last modification time of a file.
-
2Nice man - why don't you post opened PLB's comment as an extra answer? ))) Sep 17, 2012 at 13:31
-
1
-
fwrite()
returns the number of bytes written, orFALSE
on error.