View Single Post
Old 11-09-2004, 08:42 PM   #1 (permalink)
selkie
 
Newb Techie

Join Date: Nov 2004

Posts: 5

selkie

Default [C++] How to get ONE character?

Getchar() seems to make the most sense here.

Currently I'm doing [variable] = getchar();

... to get a single character. But this doesn't work: it waits for a carriage return before accepting input. The function that processes that input then runs twice instead of once: it runs once (I'm assuming) for the actual character, and once for the carriage return.

How do I get getchar() to do what I want here? I want it to process the input after every single character, without waiting for a CR. Should I be using something different?

Thanks!
Charles
selkie is offline