note 81450 added to function.fseek
| From: | seekeratexamplecom at osu1 dot php dot net | Date: | Thu, 28 Feb 2008 16:40:23 +0000 |
| Subject: | note 81450 added to function.fseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136565@lists.php.net to get a copy of this message | ||
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 :/
----
Server IP: 217.160.72.57
Probable Submitter: 217.91.51.80
----
Manual Page -- http://www.php.net/manual/en/function.fseek.php
Edit -- https://master.php.net/note/edit/81450
Del: integrated -- https://master.php.net/note/delete/81450/integrated
Del: useless -- https://master.php.net/note/delete/81450/useless
Del: bad code -- https://master.php.net/note/delete/81450/bad+code
Del: spam -- https://master.php.net/note/delete/81450/spam
Del: non-english -- https://master.php.net/note/delete/81450/non-english
Del: in docs -- https://master.php.net/note/delete/81450/in+docs
Del: other reasons-- https://master.php.net/note/delete/81450
Reject -- https://master.php.net/note/reject/81450
Search -- https://master.php.net/manage/user-notes.php