comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <chris.danx@ntlworld.com>
Subject: Re: Ada Examples and Problems
Date: Thu, 12 Apr 2001 11:15:34 +0100
Date: 2001-04-12T11:15:34+01:00	[thread overview]
Message-ID: <VefB6.5659$Ow3.1230622@news2-win.server.ntlworld.com> (raw)
In-Reply-To: zJ7B6.11027$ix4.8083746@news1.rdc1.sfba.home.com


> >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








      reply	other threads:[~2001-04-12 10:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-10 13:38 Ada Examples and Problems chris.danx
2001-04-10 17:53 ` chris.danx
2001-04-10 17:57   ` chris.danx
     [not found] ` <ERFA6.2041$FY5.146015@www.newsranger.com>
2001-04-11  9:51   ` chris.danx
2001-04-11 15:34     ` Ted Dennison
2001-04-11 17:18       ` chris.danx
2001-04-11 17:43         ` chris.danx
2001-04-11 19:01           ` Marc A. Criley
2001-04-11 19:56             ` chris.danx
2001-04-12  1:41               ` tmoran
2001-04-12 15:28         ` Ted Dennison
2001-04-12 18:56           ` chris.danx
2001-04-12 19:01             ` chris.danx
2001-04-12 21:47             ` Ted Dennison
2001-04-13  8:40               ` chris.danx
2001-04-12  1:41     ` tmoran
2001-04-12 10:15       ` chris.danx [this message]
replies disabled

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