RE: [PHP] appending to the begining of a file
| From: | Dusty Cohen | Date: | Tue, 07 Nov 2000 11:17:05 +0000 |
| Subject: | RE: [PHP] appending to the begining of a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24079@lists.php.net to get a copy of this message | ||
I suppose I could go through all that. Alternativly, I was thinking about an 'insert line'
command that I could write before I write the text. I hate the i-have-seen-it-done-attitude, but
guestbooks (for example) usually have the newest posts listed FIRST, so believe that Perl has a
function to do this. But I'm really not familiar with Perl, nor do I want to be.
Dusty
-----------------------------------------------
http://TerribleHost.com 50mg/php/mySQL $10month
-----------------------------------------------
you could read each line of the file into an array, shift the array,
add the new line to the beginning, and output the array...
just a general idea
> -----Original Message-----
> From: Dusty Cohen [mailto:dusty@dustycohen.net]
> Sent: Monday, November 06, 2000 9:58 AM
> To: php-general@lists.php.net
> Subject: [PHP] appending to the begining of a file
>
>
>
> Is there an append mode that starts at the BEGINNING of a file?
> r+ will write over anything that's already there. For instance,
> if I have the file:
> All that glitters is gold
> And she's buying a stairway to heaven.
>
> and I open the file with r+, and 'add' the text:
> There's a lady who's sure
>
> Then the resulting file is:
> There's a lady who's sure
> And she's buying a stairway to heaven.
>
> But I want:
> There's a lady who's sure
> All that glitters is gold
> And she's buying a stairway to heaven.
>
> Was this clear? Anybody have any ideas?
>
> Dusty
> -----------------------------------------------
> http://TerribleHost.com 50mg/php/mySQL $10month
> -----------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
php-list-admin@lists.php.net
>