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: root Subject: Re: Simple ADA/C Question Date: 1997/02/26 Message-ID: #1/1 X-Deja-AN: 221627434 References: <01bc23b2$ecc64960$64e2b8cd@p5120.bda> <33148127.45C@gsfc.nasa.gov> Organization: NASA/MSFC Newsgroups: comp.lang.ada Date: 1997-02-26T00:00:00+00:00 List-Id: On Wed, 26 Feb 1997, Stephen Leake wrote: > Now we need the code for the C function C_Integer_Input. If it uses > scanf with %d (or any integer format), when you feed it a real (like > "123.45"), it will read "123", and leave ".45" still in the input > stream. Then when you run Ada.Text_IO.Get, you get "." in Answer, and > exit the loop. Thanx, this is just what I am doing in C_Integer_Input ( scanf %d ). > One "solution" is to do Ada.Text_IO.Skip_Line after Do_C2; this will > throw away any unread characters (up to a line terminator). I had looked for a way to flush the buffer ( e.g. fflush( stdin ) ), but had not found one. I'll try out the method shown. > - Stephe AE