new(*args) public

Opens the file named by filename according to the given mode and returns a new File object.

See for a description of mode and opt.

If a file is being created, permission bits may be given in perm. These mode and permission bits are platform dependent; on Unix systems, see open(2) and chmod(2) man pages for details.

The new File object is buffered mode (or non-sync mode), unless filename is a tty. See IO#flush, IO#fsync, IO#fdatasync, and IO#sync= about sync mode.


f ="testfile", "r")
f ="newfile",  "w+")
f ="newfile", File::CREAT|File::TRUNC|File::RDWR, 0644)
Show source
Register or log in to add new notes.
February 23, 2013
0 thanks

Modes listed in IO class

See class IO for file open modes