comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Is this explanation correct?
Date: Sat, 30 Jun 2001 00:30:28 GMT
Date: 2001-06-30T00:30:28+00:00	[thread overview]
Message-ID: <3B3D1D97.55E372C8@acm.org> (raw)
In-Reply-To: CR6%6.32426$QM1.5302611@news2-win.server.ntlworld.com

"chris.danx" wrote:
> 
> A newbie posted asking
> 
> "There is something I don't understand about
> end_of_file stuff. When I key in my data on the file in the floppy drive, if
> I leave and save a space after the end data, I will get an End_Error . but
> when I open the file back, and get rid of that space and save, and run the
> program it works fine. can you tell me why?"
> 
> I want to check this before I relay it to the mailing list.
> 
> The program uses Ada.Integer_text_io which ignores spaces, so when the program
> get's to the space it thinks there's an integer after it and it doesn't find
> one, so it generates the end_error (exception) to let us know.
> 
> Is this correct?

It might be better to say that, with the space at the end of the file,
Ada.Integer_Text_IO.Get will stop before the space, so End_Of_File will
return False. Then the next call to Ada.Integer_Text_IO.Get will read
past the end of file looking for an Integer, causing End_Error to be
raised. With the space removed, Ada.Integer_Text_IO.Get will stop before
the line/page/file terminator, so End_Of_File will return True, and the
program will terminate normally.

-- 
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail



      reply	other threads:[~2001-06-30  0:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-29 21:54 Is this explanation correct? chris.danx
2001-06-30  0:30 ` Jeffrey Carter [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