From standard input, output and error :
, 0, 1 2, , . , , 0 1 2, - . , 3, 4 ..
$stdin.fileno
$stdout.fileno
$stderr.fileno
File.open('test1').fileno
File.open('test2').fileno
File.open('test.txt').fileno
, for_fd.
File.for_fd(7) # => #<File:fd 7> # refers file test1
File.for_fd(8) # => #<File:fd 8> # refers file test2
File.for_fd(9) # => #<File:fd 9> # refers file test.txt
Opps!, , 3,4,5,6 RubyVM.
File.for_fd(3)
File.for_fd(4)
File.for_fd(5)
File.for_fd(6)
. Ruby - 2.0.0-p451 openSUSE13.1.