This shows you the differences between two versions of the page.
uphp:functions:fopen [2017/03/27 16:41] jeff |
uphp:functions:fopen [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======fopen====== | ||
- | < | ||
- | |||
- | Open a file for reading or writing | ||
- | |||
- | ====Description==== | ||
- | <well size=" | ||
- | <span style=" | ||
- | < | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | |||
- | Attempt to open a file or stream for reading or writing, and return the file handle for future operations | ||
- | |||
- | ====Parameters==== | ||
- | < | ||
- | * ' | ||
- | * ' | ||
- | |||
- | < | ||
- | * ' | ||
- | * ' | ||
- | * ' | ||
- | |||
- | ====Return Value==== | ||
- | Upon success it returns a file handle which may be used together with the other file functions that require a handle such as [[fgets()]], | ||
- | |||
- | If the attempt to open the file or stream fails it will return 0 | ||
- | |||
- | ====Example==== | ||
- | <code php> | ||
- | <? | ||
- | $f=fopen("/ | ||
- | if ($f) { | ||
- | print(" | ||
- | fclose($f); | ||
- | } else { | ||
- | print(" | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | |||
- | ====See Also==== | ||
- | [[f485open()]] - Open the RS-485 port at the specified baud rate and parity | ||
- | |||
- | [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters | ||
- | |||
- | [[fsockopen()]] - Open an internet socket connection with optional timeout | ||
- | |||
- | [[fclose()]] - Close a file, stream or socket | ||
- | |||
- | [[feof()]] - Test if no more data is available in a file or stream | ||
- | |||
- | [[fgets()]] - Return a single line from a file or stream, with optional size limit | ||
- | |||
- | [[fread()]] - Return bytes from a file or stream | ||
- | |||
- | [[fseek()]] - Position the file pointer in an open file | ||
- | |||
- | [[ftell()]] - Return current file position in an open file | ||
- | |||
- | [[fwrite()]] - Write data to a file or stream | ||
- | |||
- | [[tar_put()]] - Add a file to an open file in TAR format | ||
- | |||
- | [[chdir()]] - Change uPHP's current directory | ||