This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:fread [2017/03/31 13:42] jeff |
uphp:functions:fread [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
< | < | ||
- | Return | + | Read bytes from a file, stream |
====Description==== | ====Description==== | ||
- | <well size=" | + | <well size=" |
- | <span style=" | + | <span style=" |
- | < | + | <span style=" |
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
Line 17: | Line 17: | ||
</ | </ | ||
- | 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 file, stream |
====Parameters==== | ====Parameters==== | ||
- | < | + | <html><b>< |
- | < | + | <html><b>< |
====Return Values==== | ====Return Values==== | ||
- | * < | + | * <html><b>< |
- | * The length of the returned string depends on available data (< | + | * < |
- | * < | + | * <html><b>< |
====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 |
- | [[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 | + | [[fgets()]] - Return a single line from a file, stream |
- | [[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 |
- | [[ftell()]] - 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 | ||
+ | |||
+ | [[fclose()]] - Close a file, stream or socket | ||