comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <chris.danx@ntlworld.com>
Subject: Re: Ada Examples and Problems
Date: Tue, 10 Apr 2001 18:53:56 +0100
Date: 2001-04-10T18:53:56+01:00	[thread overview]
Message-ID: <zMHA6.1227$Ow3.255447@news2-win.server.ntlworld.com> (raw)
In-Reply-To: b1EA6.681$Ow3.162684@news2-win.server.ntlworld.com

Hi folks,

I rewrote the part of the example that reads data from the file.  It works
now but not as i intended.

The program was supposed to read in

    a) owners first
    b) dogs second

    X) then display the output

as an example of non sequential Stream IO.  This means the problem lies with
the read_owners and the read_dogs routines.

Each owner record is followed by a dog record which is followed by a owner
record and so on.

There are five of each, meaning ten records in total.

I got the sizes of each record from the program

dog_type:    56 bytes
owner_type: 41 bytes

starting at 1, i read the first owner.
this means we're now at 42 after the first read.


Add size of dog_type in stream elements, this is byte for GNAT.
this means we're now at 56+42 = 98

add 1
we're now at 99

read next owner.


That's the theory.  The reality is different.

The reads occur at

        1
      97
    193
    289
    385
    481

Which i don't understand.

Does anyone have any ideas?


Thanks,
Chris Campbell

p.s. I got the program to work by doing a read of owner then dog 5 times.  I
wanted to demonstrate non-sequential access and this is the opposite.





  reply	other threads:[~2001-04-10 17:53 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 [this message]
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
replies disabled

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