comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@schonberg.cs.nyu.edu (Robert Dewar)
Subject: Re: Recommended way of reading file as byte blocks
Date: 1996/09/28
Date: 1996-09-28T00:00:00+00:00	[thread overview]
Message-ID: <dewar.843914492@schonberg> (raw)
In-Reply-To: R.01bba7c6$c6776fe0$0a8371a5@dhoossr.iquest.com


"
Simon Johnston <skj@ACM.ORG> wrote in article
<01BBA702.69F8B220@idc213.rb.icl.co.uk>...
Hi, I have tried a number of ways of doing this, reading a file as blocks
of bytes. In most cases when the application is examined a better way is
found, however I am now at a point where I am converting some C code which
does:

    fp = fopen(...)
    i = fread(fp, buffer, 512)
    while (!feof(fp)) {
       for ( ; i > 0; i--) {
          ..
       }
       handle buffer
       i = fread(...)
    }

and it really matters that this logic is preserved. I can open the file as
a Direct_IO(Element => BYTE) file which is nasty, I have tried using
Streams but never quite get it right.
Any ideas?
Thanks.
"


Two obvious answers. First, use stream_io, second, call fread directly.
Both allow you to duplicate the logic exactly.





  reply	other threads:[~1996-09-28  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <01BBA702.69F8B220@idc213.rb.icl.co.uk>
1996-09-21  0:00 ` Recommended way of reading file as byte blocks David C. Hoos, Sr.
1996-09-21  0:00 ` David C. Hoos, Sr.
1996-09-28  0:00   ` Robert Dewar [this message]
1996-09-29  0:00     ` Matthew Heaney
1996-09-21  0:00 ` Robert Dewar
1996-09-21  0:00 ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox