$fopen » History » Version 2
  Per Amundsen, 12/14/2016 11:54 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 | 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 | 2 | Per Amundsen | ; Print number of open files.  | 
| 25 | 1 | Per Amundsen | //echo -ag $fopen(0)  | 
| 26 | |||
| 27 | ; Print information about the 'Example' file.  | 
||
| 28 | //echo -ag $fopen(Example) position is $fopen(Example).pos  | 
||
| 29 | |||
| 30 | 2 | Per Amundsen | ; Close the file.  | 
| 31 | 1 | Per Amundsen | /fclose Example  | 
| 32 | </pre>  |