Scroll to navigation

IO.open(3kaya) Kaya module reference IO.open(3kaya)

NAME

IO::open - Open a file.

SYNOPSIS

File open( String fname, [FileMode] mode )

ARGUMENTS

fname The name of the file
mode A list of file modes

DESCRIPTION

Open the named file with the specified file modes. Not all combinations of modes are legal, and an IO.InvalidMode (3kaya) Exception will be thrown if an illegal mode is selected. A IO.FileError (3kaya) 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).

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

RELATED

IO.close (3kaya)
IO.reopen (3kaya)
August 2014 Kaya