Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The GCC compiler not supports conio.h header file. So I can't use a kbhit() function in my code. I want to determine if a key has been pressed or not.

What I have tried:

Not able to find, I tried using scanf but it's not work,I want to proper way to solve this problem.
Posted
Updated 15-Aug-19 7:33am
Comments
Stefan_Lang 16-Aug-19 3:13am    
As a general rule, check the documentation of your compiler or your OS whenever you want to do something relating to your OS or your hardware. Or else try your favorite search engine: ususally that takes less time than explaining what you want at a forum like this.

In case of GCC, since it's open source, and multiplatform, chances are there's little documentation from the compiler itself - but there will be plenty of information on the web. Just search for it, like this: https://www.google.com/search?q=GCC+Windows+key+event&rlz=1C1GCEU_deCH819CH819&oq=GCC+Windows+key+event&aqs=chrome..69i57.13943j0j8&sourceid=chrome&ie=UTF-8

1 solution

There is no "one standard way" to do that in C: even kbhit is not a standard method, it's specific to one compiler / library combination - specifically Borland.

You will have to identify the equivalent (if it exists, it doesn't have to) for the OS and libraries you are targetting.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900