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,eee47022b0e39dbb X-Google-Attributes: gid103376,public From: rodemann@mathematik.uni-ulm.de (Joerg Rodemann) Subject: Re: Exception problem Date: 1997/02/19 Message-ID: <5eea29$j0f@arktur.rz.uni-ulm.de>#1/1 X-Deja-AN: 219787747 References: <330A0D25.313@fs2.assist.uci.edu> Organization: University of Ulm, SAI, Germany Newsgroups: comp.lang.ada Date: 1997-02-19T00:00:00+00:00 List-Id: Larry Coon (larry@fs2.assist.uci.edu) wrote: > begin > Put ("Enter a positive number: "); > Get (X); > exit; -- No exception, so input was valid. > exception > when Constraint_Error => > Put_Line ("Entry must be positive. Try again."); > when Data_Error => > Put_Line ("Entry must be a number. Try again."); > end; > This code handles non-positive numeric input (eg: 0 or -3) correctly. > But when I give it non-numeric input (eg: C), it displays the "Entry > must be a number. Try again" message repeatedly and never stops for > input again. It seems to me your problem is that Get checks for validity of the data by raises the Data_Error exception already before any characters are removed from the input buffer. Therefore the token leading to Data_Error will be processed during the next Get in the same way as before. Although I do not have the ARM at hand I think a Flush(Standard_Input) might solve this situation. Hope this helps Greetings George -- Joerg 'George' Rodemann Erhard-Groezinger-Strasse 82 Department of Physics D-89134 Blaustein University of Ulm Tel. (0731) 553319 e-mail: rodemann@mathematik.uni-ulm.de