char cmdLine[MAX_PATH];
wsprintf(cmdLine,"code.exe");
SECURITY_ATTRIBUTES sa={sizeof(sa),NULL,TRUE};
SECURITY_ATTRIBUTES *psa=NULL;
DWORD dwShareMode=FILE_SHARE_READ|FILE_SHARE_WRITE;
OSVERSIONINFO osVersion={0};
osVersion.dwOSVersionInfoSize=sizeof(osVersion);
if(GetVersionEx(&osVersion)){
if(osVersion.dwPlatformId==VER_PLATFORM_WIN32_NT){
psa=&sa;
dwShareMode|=FILE_SHARE_DELETE;
}
}
HANDLE hConsoleCoutRedirect=CreateFile(
"c:\\cout.txt",
GENERIC_WRITE,
dwShareMode,
psa,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
wsprintf(cmdLine,"code.exe");
SECURITY_ATTRIBUTES sa={sizeof(sa),NULL,TRUE};
SECURITY_ATTRIBUTES *psa=NULL;
DWORD dwShareMode=FILE_SHARE_READ|FILE_SHARE_WRITE;
OSVERSIONINFO osVersion={0};
osVersion.dwOSVersionInfoSize=sizeof(osVersion);
if(GetVersionEx(&osVersion)){
if(osVersion.dwPlatformId==VER_PLATFORM_WIN32_NT){
psa=&sa;
dwShareMode|=FILE_SHARE_DELETE;
}
}
HANDLE hConsoleCoutRedirect=CreateFile(
"c:\\cout.txt",
GENERIC_WRITE,
dwShareMode,
psa,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);