[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 09:33:56 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
Hello boys and girls.
Some of us here are quite old :-(
How about 'experienced'? ;-)
I'm refreshing my C++
For that, I recomment abandoning your old school book, and getting
excellent, modern and concise "Accelerated C++":
I have ordered it from the local library.
My old school book has an example that uses getche(), which I
getchar() is close, but not exactly equivalent.
Reading keyboard *immediately* (without waiting for carriage return)
is rather tricky on UNIX.
Ok. I can live with getchar().
I use fgets() to read a string, but don't want to pertain the newline
charcter. In the old days, I used flushall(), but that doesn't seem to
be valid either. What do I do here?
And while we are at it: The same question for clrscr() ;-)
That's also quite tricky, because there is no 'screen' that you
can clear. If you really want it, you can read about curses terminal
manipulation library. "man curs_clear" or "man wclear" may work.
system("clear"); gives the desired result.
Best regards
Stefan