$fopen » History » Version 8
Per Amundsen, 02/22/2023 04:52 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$fopen(name|N)* |
||
| 4 | |||
| 5 | Returns information about an open file. |
||
| 6 | |||
| 7 | 8 | Per Amundsen | _See also [[/fopen]], [[/fclose]], [[/fwrite]], [[/fseek]], [[/flist]], [[$fread]], [[$fgetc]], [[$feof]], [[$ferr]]._ |
| 8 | 7 | Per Amundsen | |
| 9 | 1 | Per Amundsen | *Parameters* |
| 10 | |||
| 11 | 6 | Per Amundsen | table(ktable). |
| 12 | |*Parameter*|*Description*| |
||
| 13 | | name<notextile>|</notextile>N | Name of an open file, If N = 0 number of open files, otherwise the Nth open file. | |
||
| 14 | 1 | Per Amundsen | |
| 15 | *Properties* |
||
| 16 | |||
| 17 | 6 | Per Amundsen | table(ktable). |
| 18 | |*Property*|*Description*| |
||
| 19 | | .fname | Returns the name associated with the file. | |
||
| 20 | | .pos | Returns the current position in the file. | |
||
| 21 | | .eof | Returns [[$true]] if the position is as the end of the file, otherwise [[$false]]. | |
||
| 22 | | .err | *TODO* | |
||
| 23 | | .line | Returns the current line position. *(AdiIRC only)* | |
||
| 24 | 1 | Per Amundsen | |
| 25 | *Example* |
||
| 26 | |||
| 27 | <pre> |
||
| 28 | ; Open a file. |
||
| 29 | /fopen Example Example.txt |
||
| 30 | |||
| 31 | 2 | Per Amundsen | ; Print number of open files. |
| 32 | 1 | Per Amundsen | //echo -ag $fopen(0) |
| 33 | |||
| 34 | ; Print information about the 'Example' file. |
||
| 35 | //echo -ag $fopen(Example) position is $fopen(Example).pos |
||
| 36 | |||
| 37 | 2 | Per Amundsen | ; Close the file. |
| 38 | 1 | Per Amundsen | /fclose Example |
| 39 | </pre> |