I know few old functions, but they are not standardised
getch() , getche
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
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.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
> 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.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953