I wrote a program that works with a text file and should send it by email. I used curl to send by email. I call curl from the program using the WinExec() API function WinExec() program works correctly when I start it from IDE (Codeblocks), everything is called, sending by email goes, but when I just launch it not from ide, sending email does not occur. It seems to me that the problem is that the IDE calls the console for a few seconds and allows curl `to bring there all that is necessary, and when I run the program manually, the console is not called (it prevents me) Output to the console when I run from IDE: 
How can I do this in order to give time to execute curl and so that the program does not call the console for a long time, or if it did, so that it disappears faster, letting all commands execute? Approximate program code:
#include <windows.h> #include <direct.h> #include <stdio.h> #include <string.h> int main(void){ char current_work_dir[700]; char clonedir[250]; char clonedir3[250]; strcat(clonedir3,"\""); _getcwd(current_work_dir, sizeof(current_work_dir)); _getcwd(clonedir, sizeof(clonedir)); strcat(clonedir3,clonedir); strcat(clonedir3,"\\bin\\Debug\\mail.txt\" -k --anyauth"); printf("%s",current_work_dir); strcat(current_work_dir,"\\curl smtp://smtp.gmail.com:587 -v --mail-from \"andybelous2@gmail.com\" --mail-rcpt \"andybelous2@gmail.com\" --ssl -u andybelous2@gmail.com:ПАСВОРД Я ПИШУ -T "); strcat(current_work_dir,clonedir3); WinExec(current_work_dir, SW_HIDE); Sleep(10000); return 0; }