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,90f687f65a66617e X-Google-Attributes: gid103376,public From: john@assen.demon.co.uk (John McCabe) Subject: Re: Simple ADA/C Question Date: 1997/02/26 Message-ID: <33149c72.1548994@news.demon.co.uk>#1/1 X-Deja-AN: 221637693 X-NNTP-Posting-Host: assen.demon.co.uk References: <01bc23b2$ecc64960$64e2b8cd@p5120.bda> Newsgroups: comp.lang.ada Date: 1997-02-26T00:00:00+00:00 List-Id: root wrote: >On 26 Feb 1997, Bob Klungle wrote: > >begin > while To_Lower( Answer ) = 'y' > loop > Integer_To_Ada := Do_C2; > New_Line; > Put_Line( "the integer returned from the ADA function that called "); > Put_Line( "the C function is " ); > Put( Integer_To_Ada ); > New_Line( 2 ); > Put( "do you want to run again ( y/n )? " ); > Get( Answer ); > end loop; <..snip..> >I'm not capturing any exception and I don't get any exception that crashes >the program. Well, I guess since the program exits as if the default >condition was met, this is not an exception crash? As you can tell, it is >not obvious to me that an exception has occurred :). I'll go back and >read about exceptions and handling and try to figure this out. Since you didn't include all the code, I can't be sure whether this is the answer or not and have to make some assumptions however.. It sounds to me like you're trying to read an integer input and actually putting in a real e.g. 2.0. The input routine is finding the "." of 2.0 and doesn't like it (you don't get "." in integers!) therefore it abandons any further read leaving the input buffer with the ".0" in it. The next read (Get( Answer ); above) then reads in the character "." and since it isn't a "y" the program terminates. Therefore at some point you have to handle the input better, flushing the input buffer if you detect a failure of some sort. In the C function you have imported do you check for return values from the input routines (e.g. scanf)? If not then you are probably seeing what I've described here. Good luck. Best Regards John McCabe