Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IO#pos not reporting correctly for files in append mode?

0 views
Skip to first unread message

Erik Hollensbe

unread,
Apr 8, 2006, 2:34:04 AM4/8/06
to
Let's say there is a file, 'foo', which contains some text already:

f = File.open("foo", "a")
f.pos => 0 #?!?!?!
f.seek(0, IO::SEEK_END)
f.pos => correct

Now, according to the IO documentation:

"a" | Write-only, starts at end of file if file exists,
| otherwise creates a new file for writing.

This leads me to believe that IO#pos should be set to something other
than 0 if the file contains data already. Is there something wrong with
my assumption, or is this a bug (and if so, is it already known?)

I am using Ruby 1.8.4 on OS X 10.4.6.

Thanks for any help! Please Cc: me personally.
--
Erik Hollensbe
er...@hollensbe.org

0 new messages