Whenever I call strcpy
to make "SendEmail.exe " + log[1024]
into a LCSTR
I get a runtime violation exception.
I tried debugging and it hit the line:
strcpy(CmdParams, ""+log[1024]);
char log[1024];
...
if (strlen(log) > 49)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
LPSTR CmdParams;
strcpy(CmdParams, ""+log[1024]);
CreateProcessA(NULL, CmdParams, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
What should have happened was that strcpy
should have copied the values into CmdParams
and the next line should have been executed.