Method: IO#fileno

Defined in:
io.c

#filenoInteger #to_iInteger Also known as: to_i

Returns an integer representing the numeric file descriptor for ios.

$stdin.fileno    #=> 0
$stdout.fileno   #=> 1

Overloads:


2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
# File 'io.c', line 2468

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);
}