- Joined
- 2 Mar 2002
- Messages
- 1,572
The following code appends to file successfully and works perfectly.
However ... this code doesn't seem to write to the file. The only different is that I want this code to set the pointer at the beginning of the file instead of the end. Anybody have any clues to what is going on?
If you have code that does the same thing (writes a line at the beginning of a file), but is better and/or more efficient, please post.
Code:
$handle = fopen("recent.txt", 'a');
fwrite($handle, $add);
fclose($handle);
However ... this code doesn't seem to write to the file. The only different is that I want this code to set the pointer at the beginning of the file instead of the end. Anybody have any clues to what is going on?
Code:
$handle = fopen("recent.txt", 'r+');
fwrite($handle, $add);
fclose($handle);
If you have code that does the same thing (writes a line at the beginning of a file), but is better and/or more efficient, please post.