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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e67a7db835cf5a8 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Binary files vs Portablity vs Ada Date: 1999/11/05 Message-ID: <7vuto0$pv0$1@nnrp1.deja.com>#1/1 X-Deja-AN: 544774553 References: <7vt67r$qv0$1@coward.ks.cc.utah.edu> <7vurt3$ojd$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x42.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Nov 05 15:40:01 1999 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 1999-11-05T00:00:00+00:00 List-Id: In article <7vurt3$ojd$1@nnrp1.deja.com>, Robert Dewar wrote: > In article <7vt67r$qv0$1@coward.ks.cc.utah.edu>, > nahaj@u.cc.utah.edu (John Halleck) wrote: > > Is there even a portable way to get the "raw" bits for a > > file that works on all machines supporting Ada? (So that it > > can be handed to a bit oriented version of SHA.) > > Sure, have a look at Ada.Streams.Stream_IO You do have to be somewhat careful there. There's a whole lot about streams that is implmentation dependent. For one thing, there's no guarantee that you are really reading the "raw" (whatever that means) bits from the file when you do a stream IO operation, unless you wrote the stream's Read and Write routines yourself. There's no reason to expect that your vendor would do something goofy with the data (like compress it or something), but there's nothing stopping them either. There may be portability issues with the IO attributes as well. For instance, what exactly does Integer'Write send to the stream's Write procedure? The language doesn't specify it. In one instance here we were trying to 'Read data on one machine that was 'Written on another using the same code compiled with a different vendor's compiler (big mistake!). Among other portability problems, one vendor had implemented 'Write on arrays to send the elements in the array to the stream in *reverse* order. I believe that's probably against the LRM (It says elements are written in "cannonical" order), but the point is that unless you write everything yourself, the only thing you can really count on when you are using default stream implementations is that 'Read will be able to retrieve what 'Write wrote, if both were compiled with the same compiler on the same platform. -- T.E.D. Sent via Deja.com http://www.deja.com/ Before you buy.