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