« Return to Thread: Writing to a file

Re: Writing to a file

by Daniel Brown-7 :: Rate this Message:

Reply to Author | View in Thread

2009/7/3 Sándor Tamás (HostWare Kft.) <sandortamas@...>:

> The classic method is:
> 1.) read the whole file into an array of strings.
> 2.) search for the last line
> 3.) insert a string BEFORE the last line.
> 4.) write back the whole file to the same name
>
> Classic file handling does allow you to append to the end of a file, or
> recreate as a whole.
> Usually these types of editing must be done in memory, because file handling
> does not allow inserts, deletes.

    Please don't top-post in threads.  It makes them difficult to read
for folks searching the archives.

--
</Daniel P. Brown>
daniel.brown@... || danbrown@...
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

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

 « Return to Thread: Writing to a file