I have a console program that saves a log file in same directory that the .exe is in. I want to know if there is a way to either upload this file to an ftp server or send it to an emial every such amount of time.
Thanks,
OpX
Printable View
I have a console program that saves a log file in same directory that the .exe is in. I want to know if there is a way to either upload this file to an ftp server or send it to an emial every such amount of time.
Thanks,
OpX
I'm sure there are many ways of doing it, but we need to know which OS/Compiler you're using.
Does your exe keep the log file open? If so, this might prevent other programs from being able to read it.
Right now I am using M$'s Visual C++ 2010 express junk and Win7 Ultimate 64bit. No, my program does not keep the log file open
- Socket programming
- SMTP
I wouldn't rely on external programs to do the work for you.. just code it into your main program.
I don't know if I was being clear enough. I want my program to send the file automatically every X amount of minutes/hours etc.
FTP Library + timer. Not difficult at all.
How to make a timer? The easiest is just a separate thread + sleep. Sleep depends on OS. Sleep for Windows, sleep or such on Linux.
There is already an example for the ftp library.
Other than that, you would just do
Don't forget to include windows.h to use Sleep.Code:// Upload stuff
Sleep(5000); // Sleep 5 secs
// Repeat