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,5544a67afca45ba2 X-Google-Attributes: gid103376,public From: john schneider Subject: Re: Trouble w/ End_Error exception in Integer_Text_IO Date: 1997/06/16 Message-ID: <33A5B5AE.41C67EA6@ti.com>#1/1 X-Deja-AN: 248912154 References: <33a4a1c5.2804336@netnews.worldnet.att.net> Newsgroups: comp.lang.ada Date: 1997-06-16T00:00:00+00:00 List-Id: 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.