User Tools

Site Tools


uphp:library_functions:fgets_long

fgets_long

WattmonOS 3.11+

Get a string of arbitrary length from a file handle

Library

/lib/uphp/fileio.inc

Description

string fgets_long ( int $handle )

Since uPHP has a maximum length of 255 bytes for strings read from disk, this function checks for the condition and keeps reading till the end of the string.

Parameters

$handle: Valid handle of a previously opened resource

Return Values

  • String containing the line of characters (without CR/LF)

Example

<pre><?
  include("/lib/uphp/fileio.inc");
 
  $f = fopen("/logs/log.txt");
 
  if ($f) {
    $line=0;
    while (!feof($f)) {
      $st=fgets_long($f);
      print("Line ".(++$line)."=".$st);
    }
    fclose($f);
  }
 
?></pre>
uphp/library_functions/fgets_long.txt · Last modified: 2021/09/13 05:57 (external edit)