I was thinking it was obvious because otherwise I'd have just been using
that and not even posted about the "a/a+".  Using "a" works in the way that
it is supposed to (it starts at the end), but what I wanted was to use
append and then just append to anywhere in the file.

Currently to get that done I use "file(filelocation);" and then just search
that array for what I want.  Once I find it I save the key and then
concatenate what I want to that line.  Then after I've done that I implode
the array and "w" (write) that.   This of course works perfectly, but once
the file starts to get larger, I'm worried that it is going to become slow,
so I was looking for a way to append (which now that I think about it, would
do the same thing, only with less work on my part).

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >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...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to