From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 27 Aug 93 13:03:47 GMT From: cis.ohio-state.edu!math.ohio-state.edu!sol.ctr.columbia.edu!caen!saimiri. primate.wisc.edu!aplcen.apl.jhu.edu!ddsdx2.jhuapl.edu!dlc@ucbvax.Berkeley.EDU (Dave Collard x7468) Subject: Re: How to reset 'end_error' using text_io? Message-ID: <1993Aug27.130347.3911@aplcen.apl.jhu.edu> List-Id: In <1993Aug27.023237.20864@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman ) writes: >In article <25h05c$3lv@neomimsy.cs.umd.edu> alex@cs.umd.edu (Alex Blakemore) w rites: >>In article fmoore@dseg.ti.com (Freeman L. Moore) write s: >>> So, how can io_exceptions.end_error on standard input be cleared >>> permitting subsequent GETs to continue reading? >> >>text_io.skip_line I believe. >>-- >Would that it were (portably) so. Trouble is, that the End_Error was >raised because you bumped into EOF, which has a nasty tendency of causing >the file to be closed. And since you can't reopen Standard_Input, you >are stuck, at least in my experience (your implementation mileage may >vary). Hmmm. you cant reopen standard_input, but you can reopen a file with the same name as it (see below); >My guess is that if you really need to do this, you could open the >file as a named file associated with the device. Then you could (maybe) >Reset it. We had this discussion on the net about a year ago when my So is my solution portable?? anyone who can try it on their machines? it works on the VAX: with text_io; procedure enderror is buf : string(1..80); last : natural; f : text_io.file_type; begin text_io.open(file => f, mode => text_io.in_file, name => text_io.name(text_io.standard_input)); text_io.set_input(f); loop begin text_io.get_line(buf, last); text_io.put_line("got " & buf(1..last)); exception when text_io.end_error => text_io.reset(f); end; end loop; end; thanks to R_Tim_Coslet@cup.portal.com for suggesting reset(f) instead of close(f), open(...) thanks to Alex Blakemore for pointing out that i was getting the name of standard_output instead of input (which was the same on the vax normally) --Thor dlc@ddsdx2.jhuapl.edu