his is my keylogger.(me and a friend without internet).But the problem is that in myfile which i have told to him to go in C://Keylogger.txt
When i go in this file it is created but hasnt the symbol which i used and it is empty,why?
I would say check the path because "C://..." looks a bit weird for windows; i.e. I would expect "C:\\...", but you said the file got created by the program right?
Are you seeing any output to cout? (I don't know the win API well enough to know if the if-statements make sense to begin with.)
Whoa whoa. I don't have time to check what that will do to my computer first, so... No!
Just tell me if you see anything being sent to cout. Also, try deleting the file C://Keylogger.txt before running the program and see if it creates the file for you. If it doesn't you might have the wrong path! (I believe file.open("...") will create a file for you, but you might want to check that along with the Win API if that doesn't work...)
According to the code (and assuming the Win API stuff is right), if you type "Hello" you should see something like
<H><e><l><l><o>
printed to your standard output (i.e. the command prompt you executed the program in).
Looking back at your code, I would check it again. You're opening the same file a bunch of times and only checking each key once then closing it a bunch of times. Each time you open it again it will go back to the beginning of the file, i.e. overwriting what ever was in it before. Try myfile.open( "...", ios_base::app ); See http://cplusplus.com/reference/iostream/fstream/open/ about flags!
Open the file stream in main (before the loop) then pass it (by reference) to each function; finally close it after the loop ends. You should also make an exit condition for the loop.
No, I don't feel like re-writing your code. Thanks though?
int main() {
ofstream myfile;
while( true ) { //fix this condition
//I open and close in the loop here
//because this program can't terminate normally;
//nothing below the loop will ever execute!
//TODO: When you fix the loop condition,
//consider moving this line above (outside) the while loop...
myfile.open( "C:\\keys.log", ios_base::app );
//You don't need "evr";
//don't define these as member functions.
//Also, they all now need a parameter (ofstream&).
letters( myfile );
numbers( myfile );
numbers1( myfile );
others( myfile );
//TDOD: When you fix the loop condition,
//consider moving this line below (outside) the while loop...
myfile.close();
}
return 0;
}