User Tools

Site Tools


uphp:functions:fread

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:fread [2017/03/31 15:57]
jeff
uphp:functions:fread [2021/09/13 05:57] (current)
Line 3: Line 3:
 <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>
  
-Return bytes from a file or stream+Read bytes from a filestream or socket
  
 ====Description==== ====Description====
  
-<well size="sm"><html><span style="font-size:125%;color:green">mixed +<well size="sm"><html> 
-<span style="color:black"></html>[[fread]] +<span style="font-size:125%;color:green">mixed 
-<html>(+<span style="color:black">fread (
 <span style="color:green">int <span style="color:green">int
 <span style="color:blue">$handle<span style="color:black">, <span style="color:blue">$handle<span style="color:black">,
Line 17: Line 17:
 </html></well> </html></well>
  
-This function attempts to read a specified number of bytes from a file or stream. If less than the number of bytes are available it will return the available data. If no data is available it will return an empty string.+This function attempts to read a specified number of bytes from a filestream or socket. If less than the number of bytes are available it will return the available data. If no data is available it will return an empty string.
  
 ====Parameters==== ====Parameters====
  
-<html><span style="color:blue"><b>$handle</b><span style="color:black"></html>:  Valid handle of a previously opened resource+<html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource
  
-<html><span style="color:blue"><b>$bytes</b><span style="color:black"></html>:  Limit to the number of bytes returned+<html><b><span style="color:blue">$bytes<span style="color:black"></b></html>:  Limit to the number of bytes returned
  
 ====Return Values==== ====Return Values====
  
-  * <html><span style="color:green"><b>string</b><span style="color:black"></html> containing the data requested from the resource +  * <html><b><span style="color:green">String<span style="color:black"></b></html> containing the data requested from the resource 
-    * The length of the returned string depends on available data (<html><b>0 to <span style="color:blue">$bytes</b><span style="color:black"></html>) +    * <html>The length of the returned <b><span style="color:green">string<span style="color:black"></b> depends on available data (<b>0 to <span style="color:blue">$bytes<span style="color:black"></b>)</html> 
-  * <html><span style="color:green"><b>int</b><span style="color:black"></html> 0 for error+  * <html><b><span style="color:green">Integer<span style="color:black"></b></html> 0 for error
  
 ====Example==== ====Example====
  
-**Read the 32 byte MD5 hash from file /md5.txt:**+===Read the 32 byte MD5 hash from file /md5.txt===
  
 <code php> <code php>
Line 50: Line 50:
 ====See Also==== ====See Also====
  
-[[fgets()]] - Return a single line from a file or stream, with optional size limit +[[fopen()]] - Open a file for reading or writing
  
-[[fwrite()]] - Write data to a file or stream+[[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
  
-[[fopen()]] - Open a file for reading or writing+[[fgets()]] - Return a single line from a file, stream or socket, with optional size limit
  
-[[f485open()]] - Open the RS-485 port at the specified baud rate and parity+[[fwrite()]] - Write data to a file, stream or socket
  
-[[fseropen()]] - Open the serial port at the specified baud rate with optional parameters+[[feof()]] - Test if no more data is available in a file, stream or socket
  
-[[fclose()]] - Close a file, stream or socket+[[filesize()]] - Return the size of a file, or the number of unread bytes in a stream or socket
  
 [[fseek()]] - Position the file pointer in an open file [[fseek()]] - Position the file pointer in an open file
  
 [[ftell()]] - Return the current position of a file read/write pointer [[ftell()]] - Return the current position of a file read/write pointer
 +
 +[[fclose()]] - Close a file, stream or socket
  
uphp/functions/fread.1490975871.txt.gz · Last modified: 2021/09/13 05:56 (external edit)