getch() in c

L

lior l

Hello,
I am looking for a C function that works just like getch() in C++,
meaning I want the computer to wait for a one byte input and continue
(without pressing on the enter key). I have tryied "curses.h"
"ctype.h" but it doesn't work properly on Xterm.

thank you,
Lior
 
G

Greg P.

| Hello,
| I am looking for a C function that works just like getch() in C++,
| meaning I want the computer to wait for a one byte input and continue
| (without pressing on the enter key). I have tryied "curses.h"
| "ctype.h" but it doesn't work properly on Xterm.

There is no standard way to do this. It deals with your terminal's setting
(which can be different between systems, and thus is not supported by the
ANSI/ISO C standard). I think there is something about this in this
newsgroup's FAQ: http://www.eskimo.com/~scs/C-faq/top.html Just do a search
for what you are looking for (via your browser)
 
M

Malcolm

lior l said:
I have tryied "curses.h" "ctype.h" but it doesn't work properly on
Xterm.
ctype.h is a standard header giving information about character types (is a
character whitespace, is it a digit, etc). This has nothing to do with
finding a getch().
I'm surprised that curses.h doesn't work on your X system, and I would guess
that you have failed to initialise the curses system properly. However it is
not part of ANSI C so I can't go into too much detail here.
 
F

Fabian Bornhofen

lior said:
Hello,
I am looking for a C function that works just like getch() in C++,
meaning I want the computer to wait for a one byte input and continue
(without pressing on the enter key). I have tryied "curses.h"
"ctype.h" but it doesn't work properly on Xterm.

thank you,
Lior


Hi,

afaik, getch() is a function from conio.h, a non-standard header for
DOS/Windows compilers. I'm pretty sure there is no function like this
defined in C99.

Fabian
 
Joined
Oct 5, 2011
Messages
1
Reaction score
0
Answer

Hello,
I am looking for a C function that works just like getch() in C++,
meaning I want the computer to wait for a one byte input and continue
(without pressing on the enter key). I have tryied "curses.h"
"ctype.h" but it doesn't work properly on Xterm.

thank you,
Lior

Hi Friend simple answer is use <conio.h>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top