Re: Properly get a single character.
« Reply #6 on: September 17, 2008, 08:38:32 AM »
Quote from: myork on September 17, 2008, 08:14:38 AM
The problem is that you have two sources going to the same device.
Are you sure?
I think the problem is the newline stays in buffer, and is read up on next getchar() call.
I think reading the stream until newline is a simpler solution:
Code:
int myGetChar()
{
int c, dummy;
c = dummy = getchar();
while(dummy != '\n' && dummy != EOF)
dummy = getchar();
return c;
}