User Tools

Site Tools


uphp:functions:feof

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:feof [2017/03/18 13:16]
jeff
uphp:functions:feof [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======feof====== ======feof======
 +
 <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
-Test if no more data is available in a file or stream+Test if no more data is available in a filestream or socket
  
 ====Description==== ====Description====
-<well size="sm"><html><span style="font-size:125%;color:green;">int + 
-<span style="color:black;"></html>[[feof]] +<well size="sm"><html> 
-<html>+<span style="font-size:125%;color:green">int 
-<span style="color:green;">int +<span style="color:black">feof ( 
-<span style="color:blue;">$handle +<span style="color:green">int 
-<span style="color:black;">)+<span style="color:blue">$handle 
 +<span style="color:black">)
 </html></well> </html></well>
  
Line 17: Line 19:
 Return 0 (false) if there is more data available: The pointer is not at the end of the file or the stream's input has more pending data. Return 0 (false) if there is more data available: The pointer is not at the end of the file or the stream's input has more pending data.
  
-====Parameters==== +====Parameter====
-<html><span style="color:blue;"><b>handle</b><span style="color:black;"></html>:  Valid handle of a previously opened resource+
  
-====Return Value==== +<html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource 
-1 if no data available, 0 if more data available+ 
 +====Return Values==== 
 + 
 +<html><b><span style="color:green">Integer<span style="color:black"></b></html>:  1 if no data available, 0 if more data available
  
 ====Example==== ====Example====
 +
 +===Read the file index.cgi line by line and format the output for display on the screen===
 +
 <code php> <code php>
 <pre><? <pre><?
-// Read the file index.cgi line by line and format the output for display on the screen: +  $f=fopen("/index.cgi","r"); // open the file for reading and get the file handle 
-$f=fopen("/index.cgi","r"); //open the file for reading and get the file handle +  if ($f) { 
-if ($f) { +    while (!feof($f)) { 
-  while (!feof($f)) { +      print(htmlspecialchars(fgets($f))."\r\n"); // print the line to the screen 
-    print(htmlspecialchars(fgets($f))."\r\n"); //print the line to the screen+    } 
 +  fclose($f); // close the file referenced by file handle 
 +  } else { 
 +    print("Unable to open file /index.cgi");
   }   }
-  fclose($f); //close the file referenced by file handle 
-} else { 
-  print("Unable to open file /index.cgi"); 
-} 
 ?></pre> ?></pre>
 </code> </code>
  
 ====See Also==== ====See Also====
-[[fopen()]] - Open a file for reading or writing 
  
-[[f485open()]] - Open the RS-485 port as stream+[[fopen()]] - Open a file for reading or writing
  
 [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters
 +
 +[[f485open()]] - Open the RS-485 port at the specified baud rate and parity
  
 [[fsockopen()]] - Open an internet socket connection with optional timeout [[fsockopen()]] - Open an internet socket connection with optional timeout
  
-[[fread()]] - Return bytes from a file or stream+[[fread()]] - Read bytes from a filestream or socket
  
-[[fgets()]] - Return a single line from a file or stream, with optional size limit+[[fgets()]] - Return a single line from a filestream or socket, with optional size limit
  
-[[fclose()]] - Close a file, stream or socket+[[fwrite()]] - Write data to a file, stream or socket
  
-[[htmlspecialchars()]] - Convert characters for display in HTML+[[filesize()]] - Return the size of a file, or the number of unread bytes in a stream or socket
  
-[[uphp:control_structures:if]] - Flow control structure for conditional execution+[[fseek()]] - Position the file pointer in an open file 
 + 
 +[[ftell()]] - Return the current position of a file read/write pointer 
 + 
 +[[fclose()]] - Close a file, stream or socket
  
-[[uphp:control_structures:while]] - Flow control structure for a conditional loop+[[htmlspecialchars()]] - Convert special characters for display in HTML
  
uphp/functions/feof.1489842966.txt.gz · Last modified: 2021/09/13 05:56 (external edit)