Help with fwrite()
| From: | Nick Wilson | Date: | Wed, 15 Sep 2004 12:02:44 +0000 |
| Subject: | Help with fwrite() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196718@lists.php.net to get a copy of this message | ||
Hi all,
Im trying to delete a line from a file after having first read the line.
The file contains a list or urls, one per new line: like this:
urls.txt
http://example.com/somedir/
http://www.example.com/page.php?name=Nick+W
Here's what I have so far:
<?php
$file = 'urls.txt';
$f = fopen($file, 'r+');
$url2use = fgets($f);
fseek($f, 0);
fwrite($f, '', strlen($url2use)); // Where is the "gotha"?
print($url2use);
fclose($f);
?>
Clearly im using fwrite incorrectly (at least i think that's clear ;-)
but i cant seem to figure out what im doing wrong? (well, i kinda can
but i cant get any further with it without a little help..)
Much thanks for your time...
--
Nick W