comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Binary File Manip. - Possibly a stupid question
Date: 1999/07/20
Date: 1999-07-20T00:00:00+00:00	[thread overview]
Message-ID: <7n2167$td9$1@nnrp1.deja.com> (raw)
In-Reply-To: 3795BF16.BCF418D6@Think.So.Com

In article <3795BF16.BCF418D6@Think.So.Com>,
  Matthew <I.Dont@Think.So.Com> wrote:
> book with no mention of binary files) I came to the conclusion that I
> have to use some kind of Stream (since Stream_IO's End_Of_File
> references the file's size instead of a special character), but I have
> no idea how to use them properly.
>
..
> My compression alg. is currently running on the assumption that the
> stuff read in from the source file can be accessed in 8-bit-byte
chunks
> that can be mapped to character representations.

Streams wil work. However it is best to use them if both the writer and
the eventual reader are using the Ada stream packages. Its possible, if
rather unlikely, that the stream you are using could be playing tricks
on your data (eg: compressing it, reading in bizzarely sized chunks at a
time, byte swapping, etc). You *can* use streams to do this, you just
have to be careful.

If you have an *exact* representation that you want to see on disk
(minus what the file-system does to it, of course), then you should
probably use either Ada.Sequential_IO or Ada.Direct_IO. They are
generics, so you instantiate them with the data type you want to write
to the file.

Another wrinkle to throw on this is that your particular application may
be a good candidate for implemenation *as* a custom stream. :-)

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-07-20  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-21  0:00 Binary File Manip. - Possibly a stupid question Matthew
1999-07-20  0:00 ` Ted Dennison [this message]
1999-07-21  0:00   ` Gautier
replies disabled

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