comp.lang.ada
 help / color / mirror / Atom feed
From: nobody@REPLAY.COM (Anonymous)
Subject: Re: File I/O Problem/Question
Date: 1997/06/12
Date: 1997-06-12T00:00:00+00:00	[thread overview]
Message-ID: <199706121522.RAA13050@basement.replay.com> (raw)
In-Reply-To: 01bc772c$238c60c0$LocalHost@jcmarle


On 12 Jun 1997 12:30:16 GMT, "Jim Marley" <jcmarle@qis.net> wrote:

> 
> 	while not eof
> 		get_line(file, string, last)
> 		
> 		while not eol
> 			get(file, int)
> 		end loop -- eol
> 	end loop -- eof
> The program reads in the first string and first set of ints, it goes back
> to the top (inside the "while not eof"), skips the get_line and tries to
> "get" another int - causing a data exception because it's looking another
> string.

Each line ends in a line terminator. We will assume that the string
you're using to read in the string lines is longer than any such line in
the file. In that case, Get_Line skips the line terminatior on the first
line. The inner loop then reads the integers (Get), but does not skipp
the line terminator on the second line. The second time Get_Line
executes, it reads a null line and skips the line terminator on the
second line. Then you try to read integers from the third line, which
causes the exception.

Solution: Add "Text_Io.Skip_Line (File => File);" after the inner loop.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"Now go away, or I shall taunt you a second time."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/




  reply	other threads:[~1997-06-12  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-12  0:00 File I/O Problem/Question Jim Marley
1997-06-12  0:00 ` Anonymous [this message]
1997-06-12  0:00 ` Stephen Leake
replies disabled

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