writing to a file

From: Date: Fri, 22 Nov 2002 08:34:11 +0000
Subject: writing to a file
Groups: php.general 
Request: Send a blank email to php-general+get-125573@lists.php.net to get a copy of this message
Hello, im running Red Hat 7.2 with PHP 4.0.6. How would i go about writing to a file as the data is being written, not when the file is closed #!/usr/bin/php -q <? $fp=fopen('t', "a"); if ($fp === false) die("could not open file"); for($i=0; $i<10; $i++) { $time= date("D, Ymd. G:i:s"); $time = $time."\n"; $result = fwrite($fp, $time, strlen($time)); if ($result == -1) die("error writing to file"); // if ($condition) die; <-- in case this happens i would like to have the times outputted to the file 't' sleep(2); } fclose($fp); ?> i tried the above, while it is running but 't' comes up as a blank (seen using ls). How would i go about putting the contents in 't' when they are written to the file thx in advance gamin.

« previous php.general (#125573) next »