file(string path) opens the file located at path for reading. If this is not possible, an exception of class io.file is being raised. If the file has successfully been read an object of type file is returned, which can be used via subsequent calls of read or readline.
file(string path, enum mode) opens the file located at path for reading and/or writing. mode specifies wether the file is opened for reading only (`readonly), for writing only (`writeonly) or for reading and writing (`readwrite). If the file is opened for writing and it does not exist, it will be created. If the file is opened `writeonly and it does exist, it will be truncated. If you want to append to a file, open the file with the ternary version of file and specify the flag %append.
file(string, enum, bitset) opens a file and ist more flexible than the other versions of file. The second argument can be one of `readonly, `writeonly or `readwrite and specifies which operations will be allowed. The third argument is bitset allowing the following flags: %create will create the file if it is opened for writing and does not yet exist. %truncate will truncate the file to the length zero if it is opened for writing and does exist. %append will append on writing and is the opposite of %truncate. %sync will open the file with the flag O_SYNC. Any subsequent write on the resulting file will block the calling process until the data has been physically written to the underlying hardware. %direct will try to minimize cache effects of the I/O to and from this file. In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. If the opening of the file fails, an exception of the base class io will be raised.
file(int, enum) uses an existing filedescriptor and opens a file upon. The second argument must be one of `readonly, `writeonly or `readwrite
