Mauricio,

If you are on a *nix computer, you could append to the end of the file, 
close it and then do a "tail -n1" which will give you just the last line 
in the file.

HTH.
Regards

Chris

Mauricio Sthandier wrote:

>I guess I should do that.
>I need the plain file because is just a log of users registering in a Club,
>in a csv format.
>Using a database is just too much and not intended for this page... even
>when I would prefer using mysql. At least, I can handle that rather than the
>fopen and fwrite !.
>I could append but then I need to read the first 8 chars of the last line I
>appended... neither something I know how to do.
>If they were fixed I could... maybe I can fill it with blank chars the line
>until a given size ?
>
>Thanxs everyone for your replies.
>
>"Miguel Cruz" <[EMAIL PROTECTED]> escribi en el mensaje
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>>On Thu, 21 Mar 2002, Mauricio Sthandier wrote:
>>
>>>I guess thist must be really silly... but how can I append text to the
>>>beginning of a file ???
>>>I've been trying since a while... but all I get is overwriting !.
>>>
>>Open a temporary file, write your new data to it, copy the old file on to
>>the end of it, remove the old file, rename the temporary file with the old
>>file's name.
>>
>>Obviously this is not very efficient. Explore whether you really need to
>>prepend. Perhaps you can append and then read the file backwards a la tac?
>>Or perhaps a database is more useful. Or multiple files.
>>
>>miguel
>>
>
>
>




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

Reply via email to