User Tools

Site Tools


uphp:functions:filesize

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:filesize [2017/05/08 14:23]
jeff
uphp:functions:filesize [2021/09/13 05:57] (current)
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="sm"> +<well size="sm"><html>
-<html>+
 <span style="font-size:125%;color:green">int <span style="font-size:125%;color:green">int
 <span style="color:black">filesize ( <span style="color:black">filesize (
Line 18: Line 17:
 <span style="color:blue">$filename <span style="color:blue">$filename
 <span style="color:black">) <span style="color:black">)
-</html> +</html></well>
-</well>+
  
-**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://php.net/manual/en/function.stream-get-meta-data.php|stream-get-meta-data]] which returns an <html><b><span style="color:green">array<span style="color:black"></b></html> with one of the elements containing 'unread_bytes'.)) and uses an open resource handle for the parameter (which works with streams, sockets, ports and files):+**Handle Form** - The syntax is unique to uPHP,((The Handle Form is more commonly used on the [[hardware:wattmons|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://php.net/manual/en/function.stream-get-meta-data.php|stream-get-meta-data]] which returns an <html><b><span style="color:green">array<span style="color:black"></b></html> with one of the elements containing 'unread_bytes'.)) and uses an open resource handle for the parameter (which works with streams, sockets, ports and files):
  
-<well size="sm"> +<well size="sm"><html>
-<html>+
 <span style="font-size:125%;color:green">int <span style="font-size:125%;color:green">int
 <span style="color:black">filesize ( <span style="color:black">filesize (
Line 30: Line 27:
 <span style="color:blue">$handle <span style="color:blue">$handle
 <span style="color:black">) <span style="color:black">)
-</html> +</html></well>
-</well>+
  
 The Handle Form works in different ways, depending on the type of resource. For streams, sockets and ports it will return the number of unread bytes in the receive buffer. For files it will return the total number of bytes in the file.((I haven't verified this yet, perhaps for files the Handle Form returns the number of bytes remaining to be read beyond the pointer. - Jeff, 2/23/17)) The Handle Form works in different ways, depending on the type of resource. For streams, sockets and ports it will return the number of unread bytes in the receive buffer. For files it will return the total number of bytes in the file.((I haven't verified this yet, perhaps for files the Handle Form returns the number of bytes remaining to be read beyond the pointer. - Jeff, 2/23/17))
Line 41: Line 37:
 <html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource (Handle Form) <html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource (Handle Form)
  
-====Return Value====+====Return Values====
  
 <html><b><span style="color:green">Integer<span style="color:black"></b></html> number of bytes in the file, or pending in the stream or socket <html><b><span style="color:green">Integer<span style="color:black"></b></html> number of bytes in the file, or pending in the stream or socket
uphp/functions/filesize.1494253392.txt.gz · Last modified: 2021/09/13 05:56 (external edit)