From: Jeffrey Carter <spam@spam.com>
Subject: Re: Advanced file manipulation (multiple question)
Date: Wed, 02 Mar 2005 16:56:16 GMT
Date: 2005-03-02T16:56:16+00:00 [thread overview]
Message-ID: <QemVd.3382$L17.2090@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <n6-dnVKmJpaetbjfRVn-2A@comcast.com>
Steve wrote:
> If you use Ada.Direct_Io, there is a nice way to read the file in one read,
> but it takes two steps.
> First create an instance of Ada.Direct_Io of bytes.
> Open the file as bytes.
System.Storage_Elements.Storage_Element.
> Use the size function to get the size of the file.
> Close the file
> Create an instance of Ada.Direct_IO with an element that is the size of
> the file (an array of bytes maybe?).
System.Storage_Elements.Storage_Array.
> Read the file (a single read)
> Close the file.
>
> This approach tends to be quite fast since there is no iteration involved
> over the bytes of the file.
Right, but this is limited to files that will fit in memory. The streams
approach I described using varying-size chunks will work for all files,
and is equivalent to this approach for smaller files. In addition, it
does not require opening the file twice.
--
Jeff Carter
"What I wouldn't give for a large sock with horse manure in it."
Annie Hall
42
next prev parent reply other threads:[~2005-03-02 16:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 9:30 Advanced file manipulation (multiple question) Steph-ADA
2005-03-01 9:59 ` Peter Hermann
2005-03-01 12:18 ` Larry Kilgallen
2005-03-01 17:49 ` Jeffrey Carter
2005-03-02 2:42 ` Steve
2005-03-02 10:31 ` Steph-ADA
2005-03-03 3:12 ` Steve
2005-03-02 16:56 ` Jeffrey Carter [this message]
2005-03-02 17:22 ` Larry Kilgallen
2005-03-03 0:26 ` Jeffrey Carter
2005-03-03 8:16 ` Martin Krischik
2005-03-04 9:20 ` Steph-ADA
2005-03-04 10:38 ` Jean-Pierre Rosen
2005-03-03 8:56 ` Steph-ADA
2005-03-03 19:36 ` Jeffrey Carter
2005-03-03 22:32 ` Randy Brukardt
2005-03-04 2:49 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox