in reply to Why does perl get this right and C doesn't ?
Off the cuff my guess is that your perl code handles the newline you're getting (since you don't do anything visible in your C source to put the tty in raw mode) by tossing it with chomp; the C code doesn't do anything about newlines so your first call gets the letter you've pressed, the second call gets the newline that's sitting in the input buffer.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|