file class

I/O device that operates on files
Inherits
object
Description
This object class provides access to files - basic I/O operations, copying, removing etc...
Functions
$setName(<name>)
Sets the file name to <name>. It does not move the file, it just changes the file the object is "pointing to". You can not change names of already open files.
See also: $open(), $name().
$name()
Returns name set by $setName().
See also: $setName().
$open(<mode1>, <mode2>)
Attempts to open the file in specified mode or modes "sum". Valid modes are:
 Raw          - raw, non-buffered access Read         - opens the file read-only Write        - opens the file write-only ReadWrite    - opens the file in read-write mode Append       - opens the file in append mode. The file index is                set to the end of the file. Truncate     - truncates the file 
If you call this function without any parameters, the file is opened in ReadWrite + Append mode.
When working with buffered files, data is not written directly to the file at once. You must call $flush () to force it.
See also: $close(), $flush().
$isOpen()
Returns '1' if the file is open, '0' otherwise.
$close()
Closes the file, flushing the buffers first.
See also: $flush().
$flush()
Flushes the file buffer to disk. Calling this after opening the file in 'Raw' mode doesn't make much sense.
See also: $open(), $close().
$size()
Returns current file size.
$atEnd()
Returns '1' if you have reached end of the file, '0' otherwise.
See also: $seek(), $where().
$where()
Returns current position in the file (file index).
See also: $seek().
$seek(<index>)
Sets the file index to <index>.
See also: $where(), $atEnd().
$putch(<char>)
Writes character <char> to the file and increments file index.
See also: $getch(), $ungetch().
$getch()
Reads a character from the file and increments file index.
See also: $putch(), $ungetch().
$ungetch(<char>)
Puts the character <char> back to the file and decrements the file index. This is usually called to undo a $getch() call.
See also: $getch, $putch().

Main index, Object class index
KVirc 3.0.0 documentation
Generated by diego at Sat Jul 13 15:37:55 2002