From: "David A. Black" Date: 2004-11-11T11:10:45+09:00 Subject: Re: Scnaf Patch? Hi -- On Thu, 11 Nov 2004, Takao Ueda wrote: > It seems pos is undefined for STDIN. > In order to use scanf for console input I had to change the line > start_position = pos > in class IO, def scanf(str, &b) in lib/ruby/1.8/scanf.rb into > if self == STDIN > start_position = 0 > else > start_position = pos > end > > Any ideas? I believe this broke some time after 1.6.8, when pos was removed from STDIN. It was subsequently fixed, though: wobblini:~$ ruby -vrscanf -e 'p STDIN.scanf("%d%s")' ruby 1.8.2 (2004-07-29) [i686-linux] 123 abc ^D [123, "abc"] (The line you quoted is now: start_position = pos rescue 0 :-) David -- David A. Black dblack@wobblini.net