Sorry for the nubbish question , but I'm wondering which function will do the trick-read a char from keyboard without need to press "Enter"???

Recommended Answers

All 4 Replies

Member Avatar for GreenDay2001

I know few old functions, but they are not standardised getch() , getche

getchar() also.

getchar and getche functions just read a character, they serve no purpose in detecting when a key was pressed. You need to look into the kbhit function which detects keypresses and then read the character using getchar .

Read this. but mind you that the function is highly platform and compiler dependent.

> but I'm wondering which function will do the trick-read a char from keyboard without need to press "Enter"
Yes there is, but not without you saying which OS / Compiler / application type (console, GUI etc) you're trying to write.

There isn't a standard "one way works for everyone" answer to this question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.