package luaAvailable on lua
Input and Output Facilities
static close (?file:FileHandle):Void
Function to close regular files.
Saves any written data to file.
static input (file:FileHandle):Void
When called with a file name, it opens the named file (in text mode), and sets its handle as the default input file. When called with a file handle, it simply sets this file handle as the default input file. When called without parameters, it returns the current default input file.
In case of errors this function raises the error, instead of returning an error code.
static lines (?file:String):NativeIterator<String>
Opens the given file name in read mode and returns an iterator function that, each time it is called, returns a new line from the file.
static open (filename:String, ?mode:String):FileHandle
This function opens a file, in the mode specified in the string mode. It returns a new file handle, or, in case of errors,
null plus an error message.
The mode string can be any of the following:
"r": read mode (the default)
"w": write mode
"a": append mode
"r+": update mode, all previous data is preserved
"w+": update mode, all previous data is erased
"a+": append update mode, previous data is preserved, writing is only allowed at the end of file
The mode string can also have a
b at the end, which is needed in some systems to open the file in binary mode. This string is exactly what is used in the standard C function fopen.
static output (?file:String):FileHandle
static popen (command:String, ?mode:String):FileHandle
command in a separated process and returns a file handle that you can use to read data from this program (if mode is
"r", the default) or to write data to this program (if mode is
This function is system dependent and is not available on all platforms.
static tmpfile ():FileHandle
Returns a handle for a temporary file. This file is opened in update mode and it is automatically removed when the program ends.
static type (obj:FileHandle):IoType
obj is a valid file handle.
© 2005–2018 Haxe Foundation
Licensed under a MIT license.