From: john schneider <j-schneider@ti.com>
Subject: Re: Trouble w/ End_Error exception in Integer_Text_IO
Date: 1997/06/16
Date: 1997-06-16T00:00:00+00:00 [thread overview]
Message-ID: <33A5B5AE.41C67EA6@ti.com> (raw)
In-Reply-To: 33a4a1c5.2804336@netnews.worldnet.att.net
Ha Ha X wrote:
>
> I've been having a lot of trouble with an irritating feature of
> Ada.Integer_Text_IO's End_Error exception. When using the Get()
> procedure, if the user enters a manual EOF from the keyboard (^D in
> Unix, or ^Z in DOS), Get() raises End_Error. This is, I suppose,
> intended to prevent people from reading past EOF in a text file. Fine.
>
> However, when I am getting input from user with Integer_Text_IO, I
> want to just clear that EOF off the input stream, put an error
> message, and loop back for new input. Unfortunately, End_Error does
> not clear EOF off the stream. Furthermore, Skip_Line's defined
> behavior is to raise End_Error if you attempt to skip EOF.
>
> The net result is that when a user hits ^Z by accident, I am forced to
> bomb out of the program with an exception. I've searched in the AARM
> for a solution, to no avail. This problem extends to virtually every
> input procedure in Ada.Text_IO.
>
> So, in short, my question is: how can EOF be cleared off the standard
> input stream? I'm using GNAT 3.05 for MS-DOS, if that's any help.
>
> Thanks in advance.
>
> ~k.lee
> kql6708@is.nyu.edu
--
There are probably more elegant solutions, but you might try
closing and re-openinng the input stream. It's a little clumsy,
but if you're really reading user keystrokes (not data piped from
another program) you shouldn't lose more than the remainder of
the current input line -- which the user messed up with EOF, anyway!
John Schneider
j-schneider@ti.com
The opinions are mine, but you are welcome to share them.
next prev parent reply other threads:[~1997-06-16 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-06-16 0:00 Trouble w/ End_Error exception in Integer_Text_IO Ha Ha X
1997-06-16 0:00 ` john schneider [this message]
1997-06-18 0:00 ` Nick Roberts
1997-06-20 0:00 ` Do-While Jones
1997-06-21 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox