Hi,
I have a file with ten lines in it, I want to open it up, remove the last line, add a new line to the beginning and close it.
So far I can open, read, add new line of content and close but am stumped on removing the last line so there are only ever ten entries.
Any help offered would be much appreciated.
Thansk
A
$fd = fopen ($filelocation , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filelocation)) ;
echo "$fstring" ;
fclose($fd) ;
$fd = fopen ($filelocation , "w") or die ("Can't open $filename") ;
$fcounted = "<font face=arial size=2>Message: $message Sent: $time</font><br>\n$fstring" ;
$fout= fwrite ($fd , $fcounted ) ;
fclose($fd) ;