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!news.glorb.com!nx02.iad01.newshosting.com!newshosting.com!novia!transit3.readnews.com!news-out.readnews.com!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Advice on low level file handling. From: "Peter C. Chapin" References: Organization: Kelsey Mountain Software Message-ID: User-Agent: Xnews/5.04.25 Date: 06 Apr 2006 12:21:08 GMT NNTP-Posting-Host: da79d39f.news.sover.net X-Trace: DXC=Go3?Cc^e?o=F]7I\5h` 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. In other words: I probably need to treat the file as a blob of unstructured, typeless data and impose structure on it at run time rather than with compile time declarations. This seems somewhat contrary to the ideals of strong typing, but I'm not sure I see a good alternative in a case like this. I suppose this is why practical strongly typed languages have escapes from their typing mechanisms. This problem must come up frequently when writing programs that conform to externally defined binary standards. Peter