note 81449 deleted from function.fseek by felipe
| From: | felipe@php.net | Date: | Fri, 29 Feb 2008 18:20:43 +0000 |
| Subject: | note 81449 deleted from function.fseek by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-136607@lists.php.net to get a copy of this message | ||
Note Submitter: seeker at example com
----
JUST TO QUOTE AND POINT THIS OUT:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3. if you're using fseek() to write data to a file, remember to open the file in "r+"
mode, example:
$fp=fopen($filename,"r+");
DON'T open the file in mode "a" (for append), because it puts
the file pointer at the end of the file and doesn't let you
fseek earlier positions in the file (it didn't for me!). Also,
don't open the file in mode "w" -- although this puts you at
the beginning of the file -- because it wipes out all data in
the file.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Took me half a day to figure :/