Project

General

Profile

$fopen » History » Revision 7

Revision 6 (Per Amundsen, 02/22/2023 04:48 PM) → Revision 7/8 (Per Amundsen, 02/22/2023 04:52 PM)

_Added in 1.9.0_ 

 *$fopen(name|N)* 

 Returns information about an open file. 

 _See also {{/fopen]], [[/fclose]], [[/fwrite]], [[/fseek]], [[/flist]], [[$fread]], [[$fgetc]], [[$feof]], [[$ferr]]._ 

 *Parameters* 

 table(ktable). 
 |*Parameter*|*Description*| 
 | name<notextile>|</notextile>N | Name of an open file, If N = 0 number of open files, otherwise the Nth open file. | 

 *Properties* 

 table(ktable). 
 |*Property*|*Description*| 
 | .fname | Returns the name associated with the file. | 
 | .pos | Returns the current position in the file. | 
 | .eof | Returns [[$true]] if the position is as the end of the file, otherwise [[$false]]. | 
 | .err | *TODO* | 
 | .line | Returns the current line position. *(AdiIRC only)* | 

 *Example* 

 <pre> 
 ; Open a file. 
 /fopen Example Example.txt 

 ; Print number of open files. 
 //echo -ag $fopen(0) 

 ; Print information about the 'Example' file. 
 //echo -ag $fopen(Example) position is $fopen(Example).pos 

 ; Close the file. 
 /fclose Example 
 </pre>