help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [G++ n00b] getche() in G++ ?


From: Stefan Kristensen
Subject: Re: [G++ n00b] getche() in G++ ?
Date: Fri, 02 Nov 2007 11:17:17 +0100
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

getchar() is close, but not exactly equivalent. Reading keyboard
*immediately* (without waiting for carriage return) is rather tricky on
UNIX.

Indeed it is... I wrote this routine some time ago (works on Linux, not sure about FreeBSD). It uses "termios" routines to put stdin (temporarily) in "raw" mode:

<snip prgram />

Thanks. It works on FreeBSD as well :-)

When compiling with g++, it warns me that <iostream.h> is deprecated, but when using <iostream> I get an error that cout is undefined. Also, there is no man for cout. Should I use something else in stead of cout?

Best regards
Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]