Method: IO#fileno
- Defined in:
- io.c
#fileno ⇒ Integer Also known as: to_i
Returns the integer file descriptor for the stream:
$stdin.fileno # => 0
$stdout.fileno # => 1
$stderr.fileno # => 2
File.open('t.txt').fileno # => 10
f.close
2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 |
# File 'io.c', line 2886 static VALUE rb_io_fileno(VALUE io) { rb_io_t *fptr = RFILE(io)->fptr; int fd; rb_io_check_closed(fptr); fd = fptr->fd; return INT2FIX(fd); } |