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

random i/o disk file

9 views
Skip to first unread message

Tom Cloyd

unread,
Jan 4, 2008, 7:14:17 AM1/4/08
to
Am definitely on the steep part of the ruby learning curve. I've
programmed a bit in several other languages. Now I need something like a
random disk file, so I can have a large hash or something like it
available for random access. I've looked in Programming Ruby II, and the
Ruby Cookbook. No info there. I then tried to search the arhives at
http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml - the search
tool seems not to be working. I then tried to find something with
Google. No go.

I must be thinking about this wrongly, somehow.

So...how does one handle indexed (random) access to a large file - one
too large to have in memory? I can't believe that random/like disk I/O
is not possible in ruby.

Thanks in advance...

t.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< t...@tomcloyd.com >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog)
<< sleightmind.wordpress.com >> (mental health issues weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Denis Hennessy

unread,
Jan 4, 2008, 7:36:27 AM1/4/08
to
It works just like in C....

$ echo thisisatest > test.fil
$ irb
>> f = File.open('test.fil')
=> #<File:test.fil>
>> f.seek(3, IO::SEEK_SET)
=> 0
>> f.read 3
=> "sis"

/dh

Tom Cloyd

unread,
Jan 4, 2008, 8:37:23 AM1/4/08
to
Oh, man, I really DID miss something. What great news. You've made my
day, even though it hasn't really started yet.

Tks,

Tom C.

0 new messages