fputs/fgets working irregularly
| From: | Kris | Date: | Sun, 09 Jun 2002 18:17:44 +0000 |
| Subject: | fputs/fgets working irregularly | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101358@lists.php.net to get a copy of this message | ||
Hi all,
I'm having some trouble getting my basic news script to work. Here is the
code:
$fp = fopen("data/prev.txt","r");
while (!feof ($fp)) {
$pr = fgets($fp, 4096);
}
fclose($fp);
$fp = fopen("data/news.txt","r");
while (!feof ($fp)) {
$ag = fgets($fp, 4096);
}
fclose($fp);
$fp = fopen("data/news.txt","w");
$np = fputs($fp,$pr);
fclose($fp);
$fp = fopen("data/news.txt","a");
$ng = fputs($fp,$ag);
fclose($fp);
The news.txt does not append what is stored in $pr for some reason. I can't
put my finger on what the problem is, the file is chmod correctly as well.
Can anyone help?
Thanks,
Kris