C - getting pressed KeyCode (NOT stdio) -


I am trying to write a small program (in C), which writes every pressed key I txt -file (and yes, this is a keylogger).

But I do not want to use stdio, because I have FreeConsole (); .

  #include & lt; Stdio.h & gt; #include & lt; Windows.h & gt; Int main () {char c; Int i = 0; FILE * datei; Datei = fopen ("test.txt", "w +"); If (dated == faucet) exhaust (1); FreeConsole (); While (1) {c = ???}; // get the key code for the pressed key fprintf (datei, "% c", c); If (c = 27) {break; } Printf ("% c", c); } Fclose (datei); Return (0); }  

Hope I made it clear ( asha )

Thank you! :)

You can not do this with standard libraries I / O functions, which are standard library Specified in the FILE * , their data is found in the standard input ( stdin ).

In this way, it is not necessary to connect the standard input to the terminal, so that you can get the actual keystroke. You will need to see your operating system's documentation and API for this.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -