IO.pos: does it work !? [newbie question...]

Hi,
Could you please tell me why the code:

f = IO.popen(“sqlplus -s system/manager@DAS1”, “r+”)
f.write(“select ‘and now, the drive-by…’ from dual;\n”)
f.write(“exit\n”)

following OK:

while car = f.getc and car != nil
putc car
puts " [eof: #{f.pos}]\n"
end

always returns me the value ‘-1’ when ‘f.pos’ is called ?
Should I not see an increasing number ?? I see lines like:


n [eof: -1]
o [eof: -1]
w [eof: -1]
, [eof: -1]
[eof: -1]
t [eof: -1]
h [eof: -1]

Thanks…
Seb

f = IO.popen("sqlplus -s system/manager@DAS1", "r+")

[...]

always returns me the value '-1' when 'f.pos' is called ?

Well, IO#pos is the same than IO#tell and it's an error to call ftell() on
a pipe, this is why it return -1

Guy Decoux