
Patrick B. answered 06/18/19
Math and computer tutor/teacher
What do you mean by emulate???
If you actually want to write the keystroke to the keyboard buffer, you will have to
post a windows message or create an EVENT object/data structure, populate it,
and post it so the OS will process it.
In order to do that, you will need to read your windows documentation and find
the class or data objects that allow event posting or message processing.
Microsoft hijacked a lot of DOS functionality, so you may have to go through DOS-box.
============================================================
If you are just interested in the "smoke and mirrors", you can use
getchar() , getch() or getche() to read the input one character at a time
and output it to whatever "BUFFER" you like
They're in stdio.h
One of them turns off the echo so that whatever key is pressed does not get displayed.