RE: [PHP] Delete File Contents?
| From: | Jeremy Allen | Date: | Mon, 17 Dec 2001 18:23:46 +0000 |
| Subject: | RE: [PHP] Delete File Contents? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77976@lists.php.net to get a copy of this message | ||
Just open the file in mode "w".
$fp = fopen("your_file", "w");
There is also the the function fseek(), which
will allow you to move the file pointer around
to any place in the file. Mode "w" will
suffice for your needs.
fopen() - http://www.php.net/manual/en/function.fopen.php
fseek() - http://www.php.net/manual/en/function.fseek.php
Thanks
Jeremy Allen
-----Original Message-----
From: Chris [mailto:chris@escaperadius.com]
Sent: Monday, December 17, 2001 3:57 PM
To: php-general@lists.php.net
Subject: [PHP] Delete File Contents?
I've created a program that runs a process then stores the results to a
file on the server. I would like the file to contain only the most
recent update, but it seems I can only append to my using fopen. Is
there a way to open the file and overwrite the data in that file? I've
considered deleting the file and creating a new one but that seems like
a lot to do. It would be nice if there were a way to set a pointer to
the top of the file and overwrite.
Thanks,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com