This shows you the differences between two versions of the page.
uphp:functions:ftell [2017/05/11 23:03] jeff |
uphp:functions:ftell [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======ftell====== | ||
- | |||
- | < | ||
- | |||
- | Return the current position of a file read/write pointer | ||
- | |||
- | ====Description==== | ||
- | |||
- | <well size=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | |||
- | Return the current file pointer position in an active previously opened file | ||
- | |||
- | ====Parameter==== | ||
- | |||
- | < | ||
- | |||
- | ====Return Values==== | ||
- | |||
- | < | ||
- | |||
- | ====Example==== | ||
- | |||
- | <code php> | ||
- | < | ||
- | $file="/ | ||
- | $fp=fopen($file," | ||
- | if ($fp) { | ||
- | print(" | ||
- | fwrite($fp," | ||
- | print(" | ||
- | fseek($fp, | ||
- | print(" | ||
- | print(" | ||
- | fclose($fp); | ||
- | unlink($file); | ||
- | } else { | ||
- | print(" | ||
- | } | ||
- | ?></ | ||
- | |||
- | The above example will ouput: | ||
- | |||
- | < | ||
- | Beginning position: 0 | ||
- | Position after writing 10 characters: 10 | ||
- | Position after moving pointer -2: 8 | ||
- | The character at that position is: 8 | ||
- | </ | ||
- | |||
- | ====See Also==== | ||
- | |||
- | [[fopen()]] - Open a file for reading or writing | ||
- | |||
- | [[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 | ||
- | |||
- | [[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 | ||
- | |||
- | [[filesize()]] - Return the size of a file, or the number of unread bytes in a stream or socket | ||
- | |||
- | [[fseek()]] - Position the file pointer in an open file | ||
- | |||
- | [[fclose()]] - Close a file, stream or socket | ||
- | |||
- | [[unlink()]] - Delete a file | ||