Open moulie415 opened 9 years ago
Having the same issue here
Hi, The same for me but it's not really important because the code can be changed. For instance, if you comment L49:
// fprintf(logFile, "%s %s\n", fmtTime, keyCodeToReadableString(keyCode));
and replace simply by a console output:
printf("%s %s\n", fmtTime, keyCodeToReadableString(keyCode));
Then, it works like a charm when launched with sudo
. Though, since my keyboard layout is not QWERTY (I am French, we have AZERTY and it sucks) it responds like if I had a US keyboard. Doesn't really matter, just have to tweak the keyCodeToReadableString()
function.
@moulie415, @williamfiset, @jonathanlurie, and whom it may concern.
In order to write to the log file without terminating the execution you need to close the file handle with fclose
or flush the buffer with fflush
. Otherwise the entire buffer is not saved to the file while the program is running. It depends on where the buffer is kept, but it either writes on successful termination or gets deleted instead. See this SO answer for reference.
To get an idea of how you would go about flushing see these lines in caseyscarborough's keylogger.
Sorry for bumping a corpse.
CC: @dannvix
When i run the program keystroke.log gets created but it isnt recording anything, can u help?