File open(String fname, [FileMode] mode)
fname: The name of the file
mode: A list of file modes
Open the named file with the specified file modes. Not all combinations of modes are legal, and an InvalidMode Exception will be thrown if an illegal mode is selected. A FileError Exception will be thrown if opening fails for any other reason. Legal mode combinations are:
[Read,Write]: read and write to any point in the file
[Read,Append]: read from any point in the file, write to the end only (creating the file if it does not exist)
[Read]: read from any point in the file
[Write]: write to any point in the file, creating the file if it does not exist, and truncating it otherwise.
[Append]: write to the end of the file, creating the file if it doesn't exist.
Binary can be added to any of the combinations above to open the file in binary mode on Windows (it has no effect on POSIX platforms).