From: ts Date: 2001-04-05T21:01:01+09:00 Subject: [ruby-talk:13510] Re: BUG?: HP-UX 10.20 and IO#gets followed by IO#puts >>>>> "S" == SHULTZ,BARRY (HP-Israel,ex1) writes: S> If it's normal, though, why are the results different on HP-UX and NT? Does NT follow a standard ? :-) More seriously, look at fopen(3) and particulary at this paragraph (it's from Solaris but probably you have the same on HP-UX) When a file is opened with update mode (+ as the second or third character in the mode argument), both input and output may be performed on the associated stream. However, output must not be directly followed by input without an intervening call to fflush(3S) or to a file positioning function ( fseek(3S), fsetpos(3S) or rewind( 3S)), and input ^^^^^^^^ must not be directly followed by output without an interven- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ing call to a file positioning function, unless the input operation encounters end-of-file. In your case, if you add "f.eof?" it will work, because in this case it will encounters end-of-file I think this is required by ANSI-C (not really sure) Guy Decoux