new(*args) public

Opens the file named by filename according to mode (default is “r”) and returns a new File object.


See the description of class IO for a description of mode. The file mode may optionally be specified as a Fixnum by or-ing together the flags (O_RDONLY etc, again described under IO).

Optional permission bits may be given in perm. These mode and permission bits are platform dependent; on Unix systems, see open(2) for details.

Optional opt parameter is same as in <


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