D
dblack
Hi --
Just tinkering with IO#clone, in connection with some irc
chatting, and found the following behavior which puzzles
me. Here's the test program:
fh = File.new("nums") # 'nums' is 1..20, one integer per line
puts fh.gets
fd = fh.clone
puts fd.gets
puts fh.gets
and here's output from 1.6.8 and 1.8.0:
ruby 1.6.8 (2002-12-16) [i686-linux]
1
nil
2
ruby 1.8.0 (2003-08-04) [i686-linux]
1
2
nil
Actually I don't understand either of these; I thought that both runs
would produce 1\n2\n3\n.
Can anyone shed light on these examples?
David
Just tinkering with IO#clone, in connection with some irc
chatting, and found the following behavior which puzzles
me. Here's the test program:
fh = File.new("nums") # 'nums' is 1..20, one integer per line
puts fh.gets
fd = fh.clone
puts fd.gets
puts fh.gets
and here's output from 1.6.8 and 1.8.0:
ruby 1.6.8 (2002-12-16) [i686-linux]
1
nil
2
ruby 1.8.0 (2003-08-04) [i686-linux]
1
2
nil
Actually I don't understand either of these; I thought that both runs
would produce 1\n2\n3\n.
Can anyone shed light on these examples?
David