comp.lang.ada
 help / color / mirror / Atom feed
From: root <root@vf700f.msfc.nasa.gov>
Subject: Re: Simple ADA/C Question
Date: 1997/02/26
Date: 1997-02-26T00:00:00+00:00	[thread overview]
Message-ID: <Pine.LNX.3.95.970226133510.11000A-100000@vf700f.msfc.nasa.gov> (raw)
In-Reply-To: 33148127.45C@gsfc.nasa.gov


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





  reply	other threads:[~1997-02-26  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-25  0:00 Simple ADA/C Question root
1997-02-26  0:00 ` Bob Klungle
1997-02-26  0:00   ` root
1997-02-26  0:00     ` Robert Dewar
1997-02-28  0:00       ` Keith Thompson
1997-03-02  0:00         ` Robert Dewar
1997-03-04  0:00           ` Keith Thompson
1997-03-04  0:00             ` Robert Dewar
1997-03-04  0:00               ` John McCabe
1997-03-04  0:00                 ` Robert Dewar
1997-03-06  0:00                   ` Keith Thompson
1997-03-06  0:00                     ` Robert Dewar
1997-03-06  0:00                     ` Larry Kilgallen
1997-03-09  0:00                       ` Robert Dewar
1997-03-04  0:00                 ` Anders Eliasson
1997-02-26  0:00     ` John McCabe
1997-02-26  0:00     ` Stephen Leake
1997-02-26  0:00       ` root [this message]
1997-02-27  0:00 ` Robert Dewar
1997-02-27  0:00   ` root
1997-02-27  0:00   ` root
1997-03-03  0:00 ` Robert I. Eachus
1997-03-05  0:00   ` Robert Dewar
1997-03-05  0:00 ` Jon S Anthony
1997-03-06  0:00   ` Robert Dewar
1997-03-07  0:00 ` Jon S Anthony
1997-03-07  0:00   ` Robert Dewar
1997-03-07  0:00   ` Robert Dewar
1997-03-08  0:00     ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox