I/O modes : IO.new « File Directory « Ruby






I/O modes


Mode    Description

r       Read-only. Starts at the beginning of the file (default mode).
r+      Read-write. Starts at the beginning of the file.
w       Write-only. Truncates existing file to zero length or creates a new file for writing.
w+      Read-write. Truncates existing file to zero length or creates a new file for reading and writing.
a       Write-only. Starts at the end of file if the file exists, otherwise creates a new file for writing.
a+      Read-write. Starts at the end of the file if the file exists, otherwise creates a new file for reading and writing.
b       (DOS/Windows only.) Binary file mode. May appear with any of the modes listed in this table.

 








Related examples in the same category

1.To create a new I/O stream named ios, use the new method.
2.Standard streams