Right, here's some code I have:
$fp = fopen($file, "r+");
$fc = $safe_mesg;
fwrite($fp, $fc);
fclose($fp);
I would have thought that this would open the file, put the file pointer at the start, write the string, then close the file.
It does, but basically it just overwrites whatever is at the start of the file and leaves the rest of it.
I want it to write JUST whats in the $fc variable, and nothing else (including the previous file contents).
I'm testing on a Linux/PHP4 system but running on a WinNT/PHP4 server, so I dont want to use unlink() because I need the file with rwrwrw permissions and I dunno how to do that on Windows. I'm presuming chmod wont work.
I'm sure I'd be able to figure this out easily had I not gone without sleep for the last 30 odd hours, hence this being in the newbie section.
TIA