IO module
This module contains functions for file input and output, and filesystem access. File names may be given as absolute file paths, or relative to the current directory (which may be changed with System::chdir). Additional functions for handling binary files may be found in the Binary module.
Data types
- IO::Dir - A directory handle
- IO::DirEntry - A directory entry
- IO::DirInfo - Directory entry
- IO::DirTree - Directory tree
- IO::File - A file handle
- IO::FileMode - Modes for file opening.
- IO::Mode - File modes
- IO::Permission - File permissions
- IO::Permissions - Directory creation permissions
- IO::Stat - File information
Exceptions
- ClosedFile - Closed file
- DirError - Directory handling error
- FileError - File handling error
- InvalidMode - Invalid file mode error
- ReadOnlyFile - Read only file
- WriteOnlyFile - Write only file
Functions
- Builtins::Tainted<String> __t_get(IO::File handle) - Read a line from a file
- Builtins::Tainted<String> __t_getString(IO::File h) - Read a string from a binary file
- Builtins::Tainted<String> __t_readFile(String fname) - Read a text file.
- Void close(File handle) - Close a file.
- Void closeDir(Dir h) - Close a directory handle
- DirTree dirinfo(String fname) - Return a directory tree
- Bool eof(File handle) - Check for end of file.
- File file(Ptr ptr,[FileMode] mode=[Read, Write, Append]) - Create a File from a pointer
- Bool fileExecutable(String fname) - Checks a file is executable
- Bool fileExists(String fname) - Checks a file exists
- Bool fileReadable(String fname) - Checks a file is readable
- Bool fileWritable(String fname) - Checks a file is writable
- Void flush(File handle) - Flush all data to a file.
- Int fpos(File h) - Current position of file pointer
- Void fseek(File h,Int p) - Seek to a position in a file
- String get(File handle) - Read a line from a file
- Char getChar(File h) - Read one byte from a file.
- [DirInfo] getDirInfo(String fname) - Return a list of directory trees
- Int getInt(File handle) - Get a binary integer from a file.
- String getString(File h) - Read a string from a binary file
- [String] listDir(String dirname) - Get a list of files in a directory
- Void mkdir(String dname,Permissions mode=Permissions([ReadP, WriteP, ExecuteP], [ReadP, WriteP, ExecuteP], [ReadP, WriteP, ExecuteP], false, false, false)) - Makes a directory.
- File open(String fname,[FileMode] mode) - Open a file.
- Void openCheck(File file) - Check that a file handle is open
- Dir openDir(String fname) - Open a directory
- Ptr ptr(File file) - Create a Ptr from a file handle
- Void put(File handle,String val) - Write a string to a file.
- Void putChar(File handle,Char c) - Write a character to a file.
- Void putInt(File handle,Int i) - Write an integer to a file (as binary)
- Void putStr(File h,String s) - Write a string to a binary file
- Void readCheck(File file) - Check that a file handle is readable
- DirEntry readDir(Dir h) - Get the next directory entry.
- String readFile(String fname) - Read a text file.
- Void rename(String old,String new) - Rename a file
- File reopen(String fname,[FileMode] mode,File f) - Re-open a file.
- Stat stat(String fname) - Get file information.
- File stderr() - Standard error stream
- File stdin() - Standard input stream
- File stdout() - Standard output stream
- File tmpFile() - Create and open a temporary file.
- Void unlink(String fname) - Unlinks a file.
- Void writeCheck(File file) - Check that a file handle is writable
- Void writeFile(String fname,String content) - Write a text file.