Re: fputs/fgets working irregularly
| From: | Tom Rogers | Date: | Mon, 10 Jun 2002 04:40:08 +0000 |
| Subject: | Re: fputs/fgets working irregularly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101359@lists.php.net to get a copy of this message | ||
Hi
Why not just do it in one call?
$fp = fopen("data/news.txt","w");
$np = fputs($fp,$pr.$ag);
fclose($fp);
Tom
At 04:17 AM 10/06/2002, Kris wrote:
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php