This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:fopen [2017/03/17 14:11] jeff |
uphp:functions:fopen [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
======fopen====== | ======fopen====== | ||
+ | |||
< | < | ||
Line 5: | Line 6: | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | |
- | <span style=" | + | <well size=" |
- | < | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <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 | + | Attempt to open a file (or special |
====Parameters==== | ====Parameters==== | ||
- | < | + | |
+ | <html><b>< | ||
* ' | * ' | ||
* ' | * ' | ||
- | < | + | <html><b>< |
* ' | * ' | ||
* ' | * ' | ||
* ' | * ' | ||
- | ====Return | + | ====Return |
- | 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 | + | < |
+ | The file handle may be used together with the other file functions that require a handle such as [[fgets()]], | ||
====Example==== | ====Example==== | ||
+ | |||
<code php> | <code php> | ||
<? | <? | ||
- | $f=fopen("/ | + | |
- | if ($f) { | + | if ($f) { |
- | print(" | + | print(" |
- | fclose($f); | + | fclose($f); |
- | } else { | + | } else { |
- | print(" | + | print(" |
- | } | + | } |
?> | ?> | ||
</ | </ | ||
====See Also==== | ====See Also==== | ||
- | [[f485open()]] - Open the RS-485 port as a stream | ||
- | [[fseropen()]] - Open the serial port as a stream | + | [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters |
- | [[fsockopen()]] - Open an internet socket connection | + | [[f485open()]] - Open the RS-485 port at the specified baud rate and parity |
- | [[fclose()]] - Close a file, stream or socket | + | [[fsockopen()]] - Open an internet |
- | [[feof()]] - Test if no more data is available in a file or stream | + | [[fread()]] - Read bytes from a file, stream |
- | [[fgets()]] - Return a single line from a file or stream, with optional size limit | + | [[fgets()]] - Return a single line from a file, stream |
- | [[fread()]] - Return bytes from a file or stream | + | [[fwrite()]] - Write data to a file, stream |
- | [[fseek()]] - Position the file pointer in an open file | + | [[tar_put()]] - Add a file to an open file in TAR format |
- | [[ftell()]] - Return current file position | + | [[feof()]] - Test if no more data is available |
- | [[fwrite()]] - Write data to a file or stream | + | [[filesize()]] - Return the size of a file, or the number of unread bytes in a stream |
- | [[tar_put()]] - Add a file to an open file in TAR format | + | [[fseek()]] - Position the file pointer in an open file |
- | [[chdir()]] - Change uPHP' | + | [[ftell()]] - Return the current |
- | [[uphp: | + | [[fclose()]] - Close a file, stream or socket |