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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7e5c1cdfd5d69f55 X-Google-Attributes: gid103376,public From: nobody@REPLAY.COM (Anonymous) Subject: Re: File I/O Problem/Question Date: 1997/06/12 Message-ID: <199706121522.RAA13050@basement.replay.com>#1/1 X-Deja-AN: 247898996 References: <01bc772c$238c60c0$LocalHost@jcmarle> Organization: Replay and Company UnLimited X-001: Replay may or may not approve of the content of this posting Mail-To-News-Contact: postmaster@nym.alias.net X-002: Report misuse of this automated service to X-URL: http://www.replay.com/remailer/ Newsgroups: comp.lang.ada Date: 1997-06-12T00:00:00+00:00 List-Id: On 12 Jun 1997 12:30:16 GMT, "Jim Marley" 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/