Difference between revisions of "ChucK/Dev/IO/FileIO"

From CSWiki
Jump to: navigation, search
Line 6: Line 6:
 
===Methods===
 
===Methods===
 
; <code>fun int open(string path[, int flags])</code> : Opens the specified file, returning true on success and false otherwise. The flags can optionally be used to specify the mode in which to open the file (<code>FileIO.MODE_READ_WRITE</code> by default).
 
; <code>fun int open(string path[, int flags])</code> : Opens the specified file, returning true on success and false otherwise. The flags can optionally be used to specify the mode in which to open the file (<code>FileIO.MODE_READ_WRITE</code> by default).
 +
====Directories====
 +
; <code>fun int isDir()</code> : Returns true if the opened file is a directory, false otherwise.
 +
; <code>fun string[] dirList()</code> : Returns an array containing the names of each file in the opened directory, or an empty array if the opened file is not a directory.
  
 
===Events===
 
===Events===

Revision as of 12:09, 6 March 2008

The following is subject to change.

FileIO Class

The FileIO class is a subclass of the IO class.

Methods

fun int open(string path[, int flags]) 
Opens the specified file, returning true on success and false otherwise. The flags can optionally be used to specify the mode in which to open the file (FileIO.MODE_READ_WRITE by default).

Directories

fun int isDir() 
Returns true if the opened file is a directory, false otherwise.
fun string[] dirList() 
Returns an array containing the names of each file in the opened directory, or an empty array if the opened file is not a directory.

Events

Constants

FileIO.stdin
FileIO.stdout 
Pre-created files for reading from and writing to stdin and stdout.
FileIO.MODE_READ_WRITE
FileIO.MODE_READONLY
FileIO.MODE_WRITEONLY 
These flags can optionally be passed to the open function to specify the mode in which to open the file.