comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: Multiple instantiation of Ada.Direct_IO
Date: 1998/01/29
Date: 1998-01-29T00:00:00+00:00	[thread overview]
Message-ID: <01bd2c50$56b5c200$83f682c1@xhv46.dial.pipex.com> (raw)
In-Reply-To: mheaney-ya023680002801980909240001@news.ni.net


Alternatively, I think (no doubt someone will swiftly correct me if I'm
wrong :-) you can get the effect you require by making the record type
discriminated, with a default for each discriminant (so that it is a
'definite' type).

The disadvantage of this method is that, in all likelihood, each record
written in the file will be the size of the biggest possible variant,
regardless of which variant is actually written (so there could be a lot of
wasted space).  You may or may not consider this to be a serious problem. 
Personally, I would not!

-- 

== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]


Matthew Heaney <mheaney@ni.net> wrote in article
<mheaney-ya023680002801980909240001@news.ni.net>...
> In article <886003669.3982.0.nnrp-02.9e98a25e@news.demon.co.uk>, "Blake
> Weston" <blake@dedlock.demon.co.uk> wrote:
> 
> >Hi there,
> >
> >I have a bit of a problem. Basically I am using Ada.Direct_IO to read /
> >write to a file. The problem being I wish to write records of differing
> >types to the file, without closing the file and re-opening it.
> >
> >Ada 95 will not even let me open the same file as two different
file_type
> >variables as this creates a Use Exception error.
> >
> >Can anybody help?
> 
> It sounds like you want to perform heterogeneous I/O.  Direct_IO is for
> homogeneous I/O.  Try Ada.Stream_I/O instead.
> 
> --------------------------------------------------------------------
> Matthew Heaney
> Software Development Consultant
> <mailto:matthew_heaney@acm.org>
> (818) 985-1271
> 




  reply	other threads:[~1998-01-29  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-28  0:00 Multiple instantiation of Ada.Direct_IO Blake Weston
1998-01-28  0:00 ` Matthew Heaney
1998-01-29  0:00   ` Nick Roberts [this message]
1998-02-01  0:00 ` Robert Dewar
replies disabled

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