$fopen » History » Version 1
Per Amundsen, 08/11/2015 06:15 AM
| 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 | name|N - Name of an open file, If N = 0 number of open files, otherwise the Nth open file. |
||
| 10 | |||
| 11 | *Properties* |
||
| 12 | |||
| 13 | .fname - Returns the name associated with the file. |
||
| 14 | .pos - Returns the current position in the file. |
||
| 15 | .eof - Returns [[$true]] if the position is as the end of the file, otherwise [[$false]]. |
||
| 16 | .err - TODO |
||
| 17 | |||
| 18 | *Example* |
||
| 19 | |||
| 20 | <pre> |
||
| 21 | ; Open a file. |
||
| 22 | /fopen Example Example.txt |
||
| 23 | |||
| 24 | ; Print number of open files |
||
| 25 | //echo -ag $fopen(0) |
||
| 26 | |||
| 27 | ; Print information about the 'Example' file. |
||
| 28 | //echo -ag $fopen(Example) position is $fopen(Example).pos |
||
| 29 | |||
| 30 | ; Close the file |
||
| 31 | /fclose Example |
||
| 32 | </pre> |