What I'm trying to do is send an e-mail when exiting my program.
I use atexit();
function to do this but... it's not working properly.
#include <windows.h>
#include <iostream>
void SendEmail()
{
//lot of code here
}
void Print()
{
std::cout << "Bye!";
system("pause");
}
void Terminate()
{
SendEmail(blahblah); // Doesn't work
Print(); // Works
}
int main()
{
atexit(Terminate);
while (true) Sleep(1);
return 0;
}
Does SendEmail();
function take too much time and doesn't do anything? It doesn't even print the server responses (it works fine when used in main();
)