I made a keylogger and it works great. The only problem that I have is it outputs the keylogger to the txt file just after I close the console. I'd to write in the txt file while I use the keylogger and not that I'd output the keylogger just after I close the console. I am now using fstream to write the file. This is what I am doing right now to print the keylogger the the txt file
ofstream writeFile;
writeFile.open("test.txt"); // opening file
writeFile << key;