StringIO <-> File repos after eof discrepancy

R

Robert Feldt

Hi,

This discrepancy is anti-POLS for me:

$ ruby -v -rstringio -e 'f = StringIO.new("a\n"); p f.read(2); p
f.read(1); f.pos = 0; p f.read(1)'
ruby 1.8.2 (2004-12-25) [i686-linux]
"a\n"
nil
nil
$ echo a > t
$ ls -al t
-rw-r--r-- 1 feldt users 2 Jan 21 14:55 t
$ ruby -v -e 'f = File.new("t"); p f.read(2); p f.read(1); f.pos = 0;
p f.read(1)'
ruby 1.8.2 (2004-12-25) [i686-linux]
"a\n"
nil
"a"

Best,

Robert
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: StringIO <-> File repos after eof discrepancy"

|This discrepancy is anti-POLS for me:

EOF flag should be cleared by StringIO#pos=(). Thank you.

matz.
 
R

Robert Feldt

Yes (at least if new pos is less than the size?).

Thanks for quick reply,

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,440
Latest member
YoungBorel

Latest Threads

Top