Forum Moderators: coopster

Message Too Old, No Replies

fopen fputs and feof

         

Knowles

6:05 am on Nov 21, 2002 (gmt 0)

10+ Year Member



OK so I have a file I am trying to write too. Here is the set up
$file = fopen("date.txt", "w");
fwrite ($file, "$vars\n");
fclose($file);

This works but it overwrites the data each time its written to. I thought the \n would create a new line and it would automatically go to that one. I even tried adding a \n at the begining thinking it would write to the file backwards, but it doesnt! So I found the lil command feof, this is supposed to go to go to the end of the file right? I cant figure out how to put it into the script to make it do that. Any suggestions?

toadhall

6:10 am on Nov 21, 2002 (gmt 0)

10+ Year Member



Hi Knowles

$file = fopen("date.txt", "a");

a - will append to the end of the file

Knowles

6:21 am on Nov 21, 2002 (gmt 0)

10+ Year Member



toadhall your the man! Thanks that worked perfectly!