writing to first line of cvs or text file.

A

Anonymous

Guest
Hi everybody,

I have been searching around everywhere on an efficient way to edit ONLY the first line of a csv/txt file.

can you somebody help me find a good way to do this:

read the lines something like this:
$lines = file($csvfile);

and then all I want to do is append a comma to the end of the first line and and rewrite it (without wiping out the entire file).

$new_line = $lines[0].","; // this new line shoudl simply replace the first line in the file but i can't get this to work.


thanks!

-Michael
 
Back
Top