User Tools

Site Tools


uphp:functions:fgets

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:fgets [2017/05/08 14:22]
jeff
uphp:functions:fgets [2021/09/13 05:57] (current)
Line 7: Line 7:
 ====Description==== ====Description====
  
-<well size="sm"> +<well size="sm"><html>
-<html>+
 <span style="font-size:125%;color:green">mixed <span style="font-size:125%;color:green">mixed
 <span style="color:black">fgets ( <span style="color:black">fgets (
Line 17: Line 16:
 <span style="color:blue">$size <span style="color:blue">$size
 <span style="color:black">] ) <span style="color:black">] )
-</html> +</html></well>
-</well>+
  
 This function works with different resource types. If no size is specified, it will keep reading from the file, stream or socket until it reaches the end of the line (or the end of the file). For streams and sockets it will return characters until a line feed (LF) or carriage return (CR) is reached (it will wait until an entire line is received). If the optional size is specified and the line is longer than this size, the function will return only the number of characters specified. This function works with different resource types. If no size is specified, it will keep reading from the file, stream or socket until it reaches the end of the line (or the end of the file). For streams and sockets it will return characters until a line feed (LF) or carriage return (CR) is reached (it will wait until an entire line is received). If the optional size is specified and the line is longer than this size, the function will return only the number of characters specified.
 +
 +**Note:** The maximum length of a returned string in [[hardware:wattmons|Wattmon]] is 254 bytes so when reading a longer input stream, you will need to check the string length using [[strlen()]] and if it is equal to 254 you would need to perform additional reads to ensure that a full line is read from the input stream.
  
 ====Parameters==== ====Parameters====
Line 60: Line 60:
 </code> </code>
  
-====See Also====+====Also See==== 
 + 
 +[[strlen()]] - Return the length of a <html><b><span style="color:green">string</b></html>
  
 [[fopen()]] - Open a file for reading or writing [[fopen()]] - Open a file for reading or writing
uphp/functions/fgets.1494253377.txt.gz · Last modified: 2021/09/13 05:56 (external edit)