homi wasn't giving you functional code there, the variables 'n' and 'l' aren't even declared. He was demonstrating how you would setup a counter to determine when to flush the buffer. The only change I would make is at Line 13, IMHO it should be if(count >= 10000) since "count" will undoubtedly be tied to the input stream somehow and you have no way of guaranteeing that you will land exactly on 10,000.
i dont know exactly how to make a dll and i like my code. i just need a way it can pick up all keystrokes in a usb. plus i dont like using other peoples programs.
so i should replace fprintf with setwindowshookEx?
so i should replace fprintf with setwindowshookEx?
... You could do that, it will accomplish absolutely nothing though since neither function is in anyway related. If you're not going to learn how to write a DLL then you can forget about "SetWindowhookEx()" since it won't help you. You do realize though that your program as it stands pins the CPU it's on at 50-100% and one look at task manager will tell them exactly what process to kill right?
Unimportant process should seem unimportant, not like they are occupying an entire CPU core and vomiting errors when a thumb drive is removed. I'm just pointing out a flaw that you may want to address later down the line, that's all.
Why would you want the file both on the thumb drive and in your Email? Doesn't that seem redundant? Anyway don't bother with Email, FTP is the way to go. When the application exits, i.e. when the user is logging off\shutting down, have it upload to the FTP site using one of the libs the other users mentioned. Until then write your log file to the local disk in order to eliminate the lag from having to write to a thumb drive.
You should realize that an application is not a script, once it's loaded into memory you could take the thumb drive out with no detriment to it's performance as long as it isn't still talking to the thumb drive.
It was already suggested to you to use libcurl to send email via SMTP protocol, there is a working example on curl website. What you want more ? Somebody to write the code for you ? Possible, if you pay for it .....