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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1da643bcd91f37b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!news.aset.psu.edu!not-for-mail From: "Bob Spooner" Newsgroups: comp.lang.ada Subject: Re: Advice on low level file handling. Date: Thu, 6 Apr 2006 10:13:24 -0400 Organization: Penn State University, Center for Academic Computing Message-ID: References: NNTP-Posting-Host: nat2.arl.psu.edu X-Trace: f04n12.cac.psu.edu 1144332805 53410 128.118.40.77 (6 Apr 2006 14:13:25 GMT) X-Complaints-To: usenet@f04n12.cac.psu.edu NNTP-Posting-Date: Thu, 6 Apr 2006 14:13:25 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Xref: g2news1.google.com comp.lang.ada:3738 Date: 2006-04-06T10:13:24-04:00 List-Id: "Peter C. Chapin" wrote in message news:Xns979D55134B90Cpchapinsovernet@198.186.192.137... > Michael Paus wrote in news:e12grg$5nr$1 > @online.de: > >> That's exactly what Stream_IO is made for. The big advantage of Stream_IO >> is that you can read mixed types from a single stream. So you can read >> pre-defined record types and uninterpreted data (bytes) just as you like. > > Okay, I'll take a look at Stream_IO. However, as I think about this more > I'm not sure there is much to gain by reading the header data directly > into > a record. I have to do endianness conversions on the multibyte quantities > (big endian file, little endian CPU). Given that, it might be just as easy > to read the data one byte at a time and build up the record fields as I > go. > I think you should be able to do endian conversions by overriding the 'Read attributes for the types in your record where this is needed and doing the conversions in the read routines as you read in the record. This may not work for floating point values if the wrong endianness of the data occasionally produces NAN. Bob