Question:
[C Programming] How to detect if ENTER KEY is PRESSED?
anonymous
1970-01-01 00:00:00 UTC
[C Programming] How to detect if ENTER KEY is PRESSED?
Four answers:
qu4tr0
2008-10-31 01:00:27 UTC
you can use either "\n" or the ASCII equivalent of NEW LINE = 10 (check source link below)...



like:

char varchar;

varchar = getch();

if (varchar == "\n") {}



or



char varchar;

varchar = getch();

if (varchar == 10) {}





hope it helps!
handley
2016-12-16 22:44:13 UTC
no longer anymore, at one time C++ became into in basic terms an extension of C. because then, C has replaced, and so has C++. although that being pronounced this isn't any longer unusual for the comparable software to assemble the two C and C++. the approach is the comparable, yet there are in basic terms some transformations int he libraries which you want the compiler to link to.
anonymous
2016-08-29 22:42:02 UTC
I want to ask the same question as the previous person.
anonymous
2008-10-31 00:09:00 UTC
char keyin;

do

{

// Listen for keyboard input. If ENTER is pressed, terminate loop.

}

while (keyin != toupper('enter'));


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...