From: Jim Freeze Date: 2001-11-21T01:41:24+09:00 Subject: [ruby-talk:25919] Re: Why the appended '\n' in IO.readlines > >>>>> "J" == Jim Freeze writes: > > J> When reading it with IO.readlines, a newline is appended. > > Are you sure that this is ruby which has added the newline ? > You are right. I never noticed that vi put a newline in the file, even if I put only a single character in. Yuck, I thought vi wouldn't to that! In fact, it took some doing to get the single char in there: echo 'a' > t; ls -l t -rw-r--r-- 1 jfreeze sm 2 Nov 20 11:40 t printf 'a' > t; ls -l t -rw-r--r-- 1 jfreeze sm 1 Nov 20 11:41 t Thanks > pigeon% ls -l t > -rw-r--r-- 1 ts ts 1 Nov 20 17:14 t > pigeon% > > pigeon% irb > irb(main):001:0> IO.readlines("t") > ["a"] > irb(main):002:0> > pigeon% > > > Guy Decoux > ========================================================= Jim Freeze jim@freeze.org --------------------------------------------------------- Today is a fine day for Ruby programming. http://www.freeze.org =========================================================