This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:filesize [2017/03/31 13:42] jeff |
uphp:functions:filesize [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
< | < | ||
- | Return the size of a file, or the number of unread bytes in a stream | + | Return the size of a file, or the number of unread bytes in a stream |
====Description==== | ====Description==== | ||
Line 11: | Line 11: | ||
**Filename Form** - The syntax is the same as in mainline PHP, and uses a filename for the parameter: | **Filename Form** - The syntax is the same as in mainline PHP, and uses a filename for the parameter: | ||
- | <well size=" | + | <well size=" |
- | <span style=" | + | <span style=" |
- | < | + | <span style=" |
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
Line 19: | Line 19: | ||
</ | </ | ||
- | **Handle Form** - The syntax is unique to uPHP,((The Handle Form is more commonly used on the Wattmon. Compared to mainline PHP, this uPHP form is a much simpler method for retrieving the number of bytes pending in a stream. For examples of how much more complex mainline PHP can be, take a look at the PHP function [[http:// | + | **Handle Form** - The syntax is unique to uPHP,((The Handle Form is more commonly used on the [[hardware: |
- | <well size=" | + | <well size=" |
- | <span style=" | + | <span style=" |
- | < | + | <span style=" |
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
Line 33: | Line 33: | ||
====Parameters==== | ====Parameters==== | ||
- | < | + | <html><b>< |
- | < | + | <html><b>< |
- | ====Return | + | ====Return |
- | Bytes in the file or pending in the stream | + | < |
====Examples==== | ====Examples==== | ||
- | **Filename Form, output the size of the System Log:** | + | ===Filename Form, output the size of the System Log=== |
<code php> | <code php> | ||
Line 52: | Line 52: | ||
</ | </ | ||
- | **Handle Form, for a file, output the file size:** | + | ===Handle Form, for a file, output the file size=== |
<code php> | <code php> | ||
Line 63: | Line 63: | ||
?></ | ?></ | ||
- | **Handle Form, for a socket** - this example is extracted from the Wattmon OS "/ | + | ===Handle Form, for a socket=== |
+ | |||
+ | This example is extracted from the Wattmon OS "/ | ||
<code php> | <code php> | ||
Line 80: | Line 82: | ||
====See Also==== | ====See Also==== | ||
- | |||
- | [[feof()]] - Test if no more data is available in a file or stream [possibly useful if you don't need to know the exact number of bytes pending in a stream] | ||
[[findfirst()]] - Start searching the current folder for files matching a pattern and attributes [' | [[findfirst()]] - Start searching the current folder for files matching a pattern and attributes [' | ||
[[fopen()]] - Open a file for reading or writing | [[fopen()]] - Open a file for reading or writing | ||
- | |||
- | [[f485open()]] - Open the RS-485 port at the specified baud rate and parity | ||
[[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()]] - Read bytes from a file, stream or socket | ||
+ | |||
+ | [[fgets()]] - Return a single line from a file, stream or socket, with optional size limit | ||
+ | |||
+ | [[fwrite()]] - Write data to a file, stream or socket | ||
+ | |||
+ | [[feof()]] - Test if no more data is available in a file, stream or socket [possibly useful if you don't need to know the exact number of bytes pending in a stream] | ||
+ | |||
+ | [[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 | [[fclose()]] - Close a file, stream or socket | ||
Line 97: | Line 109: | ||
[[file_exists()]] - Check if a file exists | [[file_exists()]] - Check if a file exists | ||
- | [[ini_get()]] - Return the value associated with the key if it exists, or the default value otherwise | + | [[ini_get()]] - Get a value from an INI file |
- | + | ||
- | [[fread()]] - Return bytes from a file or stream | + | |
- | [[ftell()]] - Position the file pointer in an open file | ||