PHP File Reading Problem

by "Kevin Haidl" <kevinh(at)actofmind.com>

 Date:  Wed, 5 Apr 2000 01:32:27 -0700
 To:  <hwg-languages(at)mail.hwg.org>
  todo: View Thread, Original
My fgets() seems to be broken (or I've completely misunderstood the
documentation.)

$datafile = fopen($sourcePath, "r");
while(!feof($datafile)) {
    $line = fgets($datafile, 32);
    echo("$line<br>");
}

Specifically, the fgets() in the above code do not stop reading the file
when it encounters a newline.  The function always reads 31 characters.
This is distinctly inconvenient.  Anybody seen this before?  Any suggestions
for a workaround?

Linux
PHP 3.0.12

Kevin Haidl

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA