# 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(<file_name:string>)`
Sets the file name to <file_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().
`<string> $name()`
Returns name set by $setName(). See also: $setName().
`$open(<mode1:string>, <mode2:string>)`
Attempts to open the file in specified mode or modes "sum". Valid modes are:
     Raw      - raw, non-buffered access
     ReadOnly     - opens the file read-only
     WriteOnly    - 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 ReadOnly 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().
`<boolean> $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().
`<integer> $size()`
Returns current file size.
`<boolean> $atEnd()`
Returns '1' if you have reached end of the file, '0' otherwise. See also: $seek(), $where().
`<integer> $where()`
Returns current position in the file (file index). See also: $seek().
`$seek(<index:integer>)`
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().
`<char> $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().
`$readLine(<text_line:string>)`
Reads a line of text from the file and increments file index.
`$writeLine(<text_line:string>)`
Appends a line of text to the end of the file. $readBlock() $writeBlock()

Index, Object Classes

KVIrc 4.2.0.6190 Documentation
Generated by root at Tue Sep 24 07:25:10 2013