Re: Traversing an appendable file
| From: | Richard Lynch | Date: | Mon, 22 Jul 2002 22:43:22 +0000 |
| Subject: | Re: Traversing an appendable file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108966@lists.php.net to get a copy of this message | ||
>Is there any way to fseek (or something to the exact same effect) a file
>opened with "a" or "a+"?
>
>I've tried rewinding and fseeking appendable files, but neither work.
>
>Opening up in "r+" gives me part of the desired result, but if where I want
>to write is not at the end, it writes over things, which I obviously do not
>want.
It may be obvious to you that you don't want that, but it's not to anybody
else :-)
Use r+ and fseek to the end of the file. You can use PHP's filesize
(filelength?) function to find out where that is.
I think a+ is only if you are "promising" not to go backwards into the old
data... Maybe it's for some kind of OS optimization or something...
--
Like Music? http://l-i-e.com/artists.htm