From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ad5bd2429a45288e X-Google-Attributes: gid103376,public From: dewar@schonberg.cs.nyu.edu (Robert Dewar) Subject: Re: Recommended way of reading file as byte blocks Date: 1996/09/28 Message-ID: #1/1 X-Deja-AN: 185833836 references: <01BBA702.69F8B220@idc213.rb.icl.co.uk> organization: New York University newsgroups: comp.lang.ada Date: 1996-09-28T00:00:00+00:00 List-Id: " Simon Johnston 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.