Storing the entered key in a file

using namespace std;
int main()
ofstream fout("log.txt");
char c;
return 0;

it stores the char enterd by user untill console in closed..

Actually i heared about keyloggers and i have tried some...Can any one please
share some useful links so i will be able to make my own...thnx in advance
First off - I'm going to assume that this is a project you are doing to learn c++, as opposed to malicious purposes.

What you want is for the program to run in the background, so it runs, yet not directly visible to the user.
On windows, such programs are called services, on Linux they're called daemons.

So what you're looking for is to make your program either of these, depending on your platform.
Google should be able to help you with that.

All the best,
Topic archived. No new replies allowed.