Skip to content
class method

IO.sysopen

(::String path, ?::String mode, ?::String perm) -> ::Integer
IO.sysopen(path, mode = 'r', perm = 0666) → integer

Opens the file at the given path with the given mode and permissions; returns the integer file descriptor.

If the file is to be readable, it must exist; if the file is to be writable and does not exist, it is created with the given permissions:

Example
File.write('t.tmp', '')  # => 0
IO.sysopen('t.tmp')      # => 8
IO.sysopen('t.tmp', 'w') # => 9
See also .select .try_convert .readlines .write also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0