User Tools

Site Tools


uphp:functions:fwrite

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:fwrite [2017/07/06 11:39]
admin
uphp:functions:fwrite [2021/09/13 05:57] (current)
Line 20: Line 20:
 </html></well> </html></well>
  
-This function performs a binary-safe write of strings or bytes specified by integers to a previously opened resource((<html>This function is similar to the mainline PHP function, but with the addition of the ability to write bytes specified as an <b><span style="color:green">integer<span style="color:black"></b>, and the ability to write <b><span style="color:green">string<span style="color:black"></b> or <b><span style="color:green">integer<span style="color:black"></b> data from an <b><span style="color:green">array<span style="color:black"></b>. Both of these capabilities simplify programming in uPHP for the Wattmon: data to be written can be specified as an <b><span style="color:green">int<span style="color:black"></b> byte value instead of a string, or a series of writes of either type can be combined into one statement by the use of an <b><span style="color:green">array<span style="color:black"></b>.</html>))+This function performs a binary-safe write of strings or bytes specified by integers to a previously opened resource((<html>This function is similar to the mainline PHP function, but with the addition of the ability to write bytes specified as an <b><span style="color:green">integer<span style="color:black"></b>, and the ability to write <b><span style="color:green">string<span style="color:black"></b> or <b><span style="color:green">integer<span style="color:black"></b> data from an <b><span style="color:green">array<span style="color:black"></b></html>. Both of these capabilities simplify programming in uPHP for the [[hardware:wattmons|Wattmon]]: data to be written can be specified as an <html><b><span style="color:green">int<span style="color:black"></b> byte value instead of a string, or a series of writes of either type can be combined into one statement by the use of an <b><span style="color:green">array<span style="color:black"></b>.</html>))
  
 ====Parameters==== ====Parameters====
Line 75: Line 75:
  
 ====Note==== ====Note====
 +
 When working with binary data such as data read from a file using fread(), make sure to pass the variable as a pointer using the & symbol.  Otherwise a copy of the string will be made but will only be copied until the first NULL character is found. When working with binary data such as data read from a file using fread(), make sure to pass the variable as a pointer using the & symbol.  Otherwise a copy of the string will be made but will only be copied until the first NULL character is found.
  
Line 96: Line 97:
   fclose($fh);   fclose($fh);
   fclose($fo);   fclose($fo);
-   
 ?> ?>
 </code> </code>
 +
 ====See Also==== ====See Also====
  
uphp/functions/fwrite.1499341157.txt.gz · Last modified: 2021/09/13 05:56 (external edit)