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.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to