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: "Nick Roberts" Subject: Re: Trouble w/ End_Error exception in Integer_Text_IO Date: 1997/06/18 Message-ID: <01bc7c33$c23a2ca0$LocalHost@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 249433936 References: <33a4a1c5.2804336@netnews.worldnet.att.net> Organization: UUNet UK server (post doesn't reflect views of UUNet UK) Newsgroups: comp.lang.ada Date: 1997-06-18T00:00:00+00:00 List-Id: Ha Ha X wrote in article <33a4a1c5.2804336@netnews.worldnet.att.net>... > 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. [...] A possible solution is to use Get_Immediate instead of Get, and write a little procedure which accumulates characters into a string and then uses the integer version of Get on the string. Line buffering still works under GNAT for DOS (because it doesn't disable DOS' line buffering (which it should!)), but, of course, it may not under other environments or Adas. What Adas for DOS should all offer is an open option (via the Form parameter) which disables EOF character detection for a text input stream (other kinds of EOF detection unaffected), and this should be the default for standard input (there is no tradition of using ^Z to terminate user input under DOS, as there is (using ^D) under UNIX). Such an option isn't workable for UNIX (I think) because the kernel converts the ^D into a 'hard' EOF (read returns 0). There could always be an option to ignore EOF altogether (but never as a default). Perhaps a better solution is to simply accept that ^Z or ^D raises an exception, and to handle that exception as a way for the user to forcefully terminate the program (or similar). Or you could just tell your users not to press ^Z! Nick.