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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4ef9c02a78f0071f X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Multiple instantiation of Ada.Direct_IO Date: 1998/01/29 Message-ID: <01bd2c50$56b5c200$83f682c1@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 320124419 Content-Transfer-Encoding: 7bit References: <886003669.3982.0.nnrp-02.9e98a25e@news.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: UUNet UK server (post doesn't reflect views of UUNet UK) Newsgroups: comp.lang.ada Date: 1998-01-29T00:00:00+00:00 List-Id: 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 wrote in article ... > In article <886003669.3982.0.nnrp-02.9e98a25e@news.demon.co.uk>, "Blake > Weston" 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 > > (818) 985-1271 >