Is there any way of getting input directly from keyboard without it getting written onto screen?

I tried the standard O/I functions, but they don't help. I also looked into C libraries, but there wasn't and useful function (unless I missed some).

I need only one one key from keyboard, so I use getchar() now. The program is dependant on what key the user presses.

Recommended Answers

All 5 Replies

There are a couple options
1. If your compiler supports conio.h then it contains a couple functions that will do what you want.

2. Use OS-specific api functions. For MS-Windows there are some console functions you can use (link here)

The first option fixed my problem. Thank you.

I need to make one of my functions run faster, (because the game is very dependant on how quickly it runs) can I post it here or should I go elsewhere?

Yes, post it.

You don't have to. I decided that I will post it later, because I don't know one important thing in C. And that thing could be the cause, why I can't make it faster. If it won't help, then I will post in this forum.

In other words this tread can be locked.

It's your thread. Mark it solved.

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.