Re: delete file contents (sorry if i posted this twice, problem with signing up)
| From: | Dobromir Velev | Date: | Wed, 12 Dec 2001 08:40:18 +0000 |
| Subject: | Re: delete file contents (sorry if i posted this twice, problem with signing up) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14955@lists.php.net to get a copy of this message | ||
Hi,
the easiest way is to open the file in a write only mode.
$fp=fopen("/var/mail/myaccount","w");
$fclose($fp);
Here's an excerpt from http://www.php.net/manual/en/function.fopen.php
'w' - Open for writing only; place the file pointer at the beginning of the file and
truncate the file to zero length. If the file
does not exist, attempt to create it.
Hope this helps
Dobromir Velev
Web Developer
http://www.websitepulse.com/
-----Original Message-----
From: DigitalKoala <annazaraah@yahoo.com>
To: php-db@lists.php.net <php-db@lists.php.net>
Date: Tuesday, December 11, 2001 19:09
Subject: [PHP-DB] delete file contents (sorry if i posted this twice, problem with signing up)
>Hi Everyone,
>
>I'm running a script that automatically reads lines from
>/var/mail/myaccount, parses the lines then insert specific items into a
>database.... this is in a loop
>
>What i want to do is then delete the contents of the file, but not the file
>itself...can you tell me the best way to do this?
>
>many thanks
>anna
>
>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>