Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing a text file 1

Status
Not open for further replies.

MagicalDean

Technical User
Feb 16, 2005
61
GB
This is a bit of code I have to administrate a text file based comment system on my site:

$file = "./shouts.txt";
$fp = fopen($file, "r+");

rewind($fp);
fwrite($fp,$shout);
fclose($fp);

The shouts.txt file exists and is editable, ie has the right CHMOD values. But is there any way I can delete the entire contents of the file first, and then have it write in $shout. Sorry if this is kinda confusing, but any help is greatly apprechiated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top