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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae40b60d59bcdc4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-12 12:04:46 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!diablo.theplanet.net!dispose.news.demon.net!demon!nntp.news.xara.net!xara.net!gxn.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: Subject: Re: Ada Examples and Problems X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Thu, 12 Apr 2001 19:56:42 +0100 NNTP-Posting-Host: 213.104.124.99 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 987101780 213.104.124.99 (Thu, 12 Apr 2001 19:56:20 BST) NNTP-Posting-Date: Thu, 12 Apr 2001 19:56:20 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6836 Date: 2001-04-12T19:56:42+01:00 List-Id: Hi, > Oh. So you actually wrote code to convert Dog_Type into Stream_Elements and send > it to Ada.Streams.Write? That changes things significantly. In that case you > do know exactly how many stream elements Dog_Type uses. Ok maybe i'm confused as to what you meant. I wrote the following procedure owner_write (s : access ... item : in owner_type) is begin owner_name_type'write (s, item.name); integer'write (s, item.age); sex_type'write (s, item.sex); end owner_write; but i get the feeling that's not what you meant. Is it? > So its just a simple matter > of updating the file index by that many elements (probably *not* 1 though). I've got a small problem with sex_type which is a single bit. I thought about for sex_type'size use 8; I'll make this change soon. > >If what you've said is correct how then can i write the code so that i don't > >need to count each individual entry and hardwire it into the program. It'd > >be much nicer if when i changed the types, i could just recompile the > >modules without changing the values for the sizes of records. > > You've already hit upon the answer: Write your own 'Write and 'Read routines, > and then your code can properly size itself automaticly. (If this isn't what you > did, tell me. I probably can dig up an example of this to post). I don't know if i did what you suggested or not. Are you suggesting using (I don't recall this properly i saw it in the LRM) something like stream_element_array? Even if my read write routines are correct, how can my code adjust automatically. I want to skip records in the stream, to do that i need to know the size of the block i'm jumping over. I don't want to read the block in order to skip it. I want to just jump over it. I must be missing something somewhere (like my brains')! Thanks, Chris.