comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pchapin@sover.net>
Subject: Re: Advice on low level file handling.
Date: 06 Apr 2006 12:21:08 GMT
Date: 2006-04-06T12:21:08+00:00	[thread overview]
Message-ID: <Xns979D55134B90Cpchapinsovernet@198.186.192.137> (raw)
In-Reply-To: e12grg$5nr$1@online.de

Michael Paus <pausnospam@nospamib-paus.com> 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



  reply	other threads:[~2006-04-06 12:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  2:47 Advice on low level file handling Peter C. Chapin
2006-04-02 10:55 ` Georg Bauhaus
2006-04-04  1:31 ` Randy Brukardt
2006-04-05 10:41   ` Peter C. Chapin
2006-04-06  7:43     ` Michael Paus
2006-04-06 12:21       ` Peter C. Chapin [this message]
2006-04-06 12:46         ` Dmitry A. Kazakov
2006-04-06 14:13         ` Bob Spooner
2006-04-07 10:48         ` Stephen Leake
replies disabled

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