 |
 |
Command : File
|
| |
Syntax
FILE [open|close|show] [file-identifier] [filename] [flags]
Description
This command will open or close an external file.
FILE open <file-identifier> <filename> [ read [circular] ] | [ write [truncate] ]
This will open a file , assigning it to the [ file-identifier ].
The next operations on the file will require that identifier.
You can specify the READ flag (default) to open the file in read-only mode.
Additionally the CIRCULAR flag may be used to set the 'circular' read mode:
When you are at the end of the file , you start at the beginning.
If no circular flag is provided , the file reading will terminate with $_null
after the file end was reched.
You can specify the WRITE flag , to open the file in write-only mode.
Additionally the TRUNCATE flag may be added,to truncate to zero length an
existing file.
If the file doesn't exist, it will be created.
You can use the $%fio_isopen function to check if the file was open succesfully.
FILE close <file-identifier>
This will close a file , or do nothing if the file was not open.
FILE SHOW
This will show a list of currently open files.
It is NOT a good idea to keep a file open for a long time.
If a file is not being used for 5 minutes (no read or write calls) , KVirc will automatically
close it.
Example
This will open a file, read the first line and close it.
/FILE open test $_dirkvirc/Misc/test.txt read circular;
/if ($%fio_isopen[test])echo $_window $%fio_readln[test];
/FILE close test;
See also
Index  Command list  Commandline syntax