... try this
Code:
#include <stdio.h>
main ()
{
int i;
char c;
for (; ((c = getc (stdin)) != '\n') && c != EOF;)
{
ungetc (c, stdin);
scanf ("%d", &i);
printf ("%d", i);
printf (" ");
// Firugre out what the binary equivalent is...
printf ("You typed in %d, BTW.\n", i);
}
return 0;
}
It is quite possible that this is what you want. I think it's compiler dependent, but I'm pretty much relying on the fact that once you do the first scanf or getc, the program's not going to do any processing untill you're finished supplying the buffer with input (you finish by pressing enter... or maybe by putting in too many characters). All the stuff with the char c is just to detect whether return has actually been encountered.
Again however, I stress that this is compiler dependent. Try compiling it, and see if it works for you.