e$B1sF#$G$9!#e(B
e$B2<5-$N$h$&$K!“FI$_$+$1$Ne(B File e$B%$%s%9%?%s%9$r;H$C$Fe(B 2
e$B2se(B reopen e$B$7$?e(B
e$B$H$-$N5sF0$,!”%P!<%8%g%s$K$h$C$F$^$A$^$A$G$9!#e(B
$ cat foo.txt
1
2
3
$ cat bar.txt
a
b
c
$ cat t.rb
f1 = File.new(“foo.txt”)
f2 = File.new(“bar.txt”)
f1.reopen(f2)
f1.gets
f1.gets
p f1.reopen(f2).gets
$ ruby18 -v t.rb
ruby 1.8.8dev (2010-01-27 revision 26440) [i686-linux]
“a\n”
$ ruby-1.9.1-p378 -v t.rb
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
nil
$ ./ruby -v t.rb
ruby 1.9.2dev (2010-01-31 trunk 26528) [i686-linux]
“c\n”
e$B$I$&$J$k$N$,@52r$G$7$g$&$+!#e(B