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 03:21:38 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!diablo.netcom.net.uk!netcom.net.uk!nntp.news.xara.net!xara.net!gxn.net!server6.netnews.ja.net!server4.netnews.ja.net!news5-gui.server.ntli.net!ntli.net!news2-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 11:15:34 +0100 NNTP-Posting-Host: 213.104.120.104 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 987070517 213.104.120.104 (Thu, 12 Apr 2001 11:15:17 BST) NNTP-Posting-Date: Thu, 12 Apr 2001 11:15:17 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6809 Date: 2001-04-12T11:15:34+01:00 List-Id: > >It works on a sequential read but not on a non-sequential read. > "For direct access, the file is viewed as a set of elements > occupying consecutive positions in linear order;..." LRM A.8(3) > So each element of a direct access file must be the same size. > Since you have owner, dog, owner, dog... where owner and dog are > different size records, that won't work. But "Pair" in > type Pair is > Person : Owner; > Animal : Dog; > end record; > is a constant size record. If you want the N-th owner, or N-th dog, > Set_Index(The_File, N); > That seems easier than taking the individual byte as the constant > size element and then doing arithmetic that you hope gets you to > the correct byte position. Thanks for that I'll use it in future. The reason i did it with two different sized records was because I'm writing a driver for a file system. It's contigouous which means i've got to do all sorts of mad calculations and access the stream. It's not fun. Thanks again, Chris Campbell http://willow.os-4u.com