This shows you the differences between two versions of the page.
uphp:functions:feof [2017/03/18 19:06] jeff |
uphp:functions:feof [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======feof====== | ||
- | < | ||
- | |||
- | Test if no more data is available in a file or stream | ||
- | |||
- | ====Description==== | ||
- | <well size=" | ||
- | <span style=" | ||
- | < | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | |||
- | Return 1 (true) if no more data is available: The pointer is at the end of the file (EOF) or there is no more data pending in the stream' | ||
- | |||
- | Return 0 (false) if there is more data available: The pointer is not at the end of the file or the stream' | ||
- | |||
- | ====Parameters==== | ||
- | < | ||
- | |||
- | ====Return Value==== | ||
- | 1 if no data available, 0 if more data available | ||
- | |||
- | ====Example==== | ||
- | **Read the file index.cgi line by line and format the output for display on the screen:** | ||
- | |||
- | <code php> | ||
- | < | ||
- | $f=fopen("/ | ||
- | if ($f) { | ||
- | while (!feof($f)) { | ||
- | print(htmlspecialchars(fgets($f))." | ||
- | } | ||
- | fclose($f); // close the file referenced by file handle | ||
- | } else { | ||
- | print(" | ||
- | } | ||
- | ?></ | ||
- | </ | ||
- | |||
- | ====See Also==== | ||
- | [[fopen()]] - Open a file for reading or writing | ||
- | |||
- | [[f485open()]] - Open the RS-485 port as a stream | ||
- | |||
- | [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters | ||
- | |||
- | [[fsockopen()]] - Open an internet socket connection with optional timeout | ||
- | |||
- | [[fread()]] - Return bytes from a file or stream | ||
- | |||
- | [[fgets()]] - Return a single line from a file or stream, with optional size limit | ||
- | |||
- | [[fclose()]] - Close a file, stream or socket | ||
- | |||
- | [[htmlspecialchars()]] - Convert characters for display in HTML | ||