Page 1 of 1

Re: getch() for non-windows systems?

Posted: Sat Oct 09, 2010 11:38 am
by dandymcgee
Is there a reason you can't just read in a char?

Code: Select all

char c;
std::cin >> c;

Re: getch() for non-windows systems?

Posted: Sat Oct 09, 2010 12:40 pm
by Ginto8
IMNEW11 wrote:That's C++, im looking for C..
and i want it to be multi-platform.
getchar() reads a single character from stdin. However, what you may want to do is something like this:

Code: Select all

while(getchar() != '\n');
so that you know you're pausing, then continuing with a cleared buffer.

Re: getch() for non-windows systems?

Posted: Sat Oct 09, 2010 3:46 pm
by dandymcgee
IMNEW11 wrote:That's C++, im looking for C..
and i want it to be multi-platform.
I don't know of any alternative that would work on all systems without #IFDEFs. :| Try Google.