STARTUPINFOA syst;
PROCESS_INFORMATION prc;
OFSTRUCT of;
GetStartupInfo(&syst);
HANDLE h1=CreateFile("D:\\testing\\out", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,NULL);
HANDLE h2 = (HANDLE)OpenFile("D:\\testing\\in", &of, OF_READ);
ZeroMemory(&syst,sizeof(STARTUPINFO));
syst.cb=sizeof(STARTUPINFO);
syst.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
syst.hStdInput = h2;
syst.hStdOutput = h1;
CreateProcess( "D:\\testing\\n.exe", 0, 0, 0, FALSE, REALTIME_PRIORITY_CLASS, 0, 0, &syst, &prc);
WaitForSingleObject( prc.hProcess, INFINITE );
CloseHandle(h2);
CloseHandle(h1);
Запуск ДОС-программы и переопределение консольного ввода/вывода
Код:
Проблема:создает выходной файл 0 байт, т.е. не чего туда непишет, ПОЧЕМУ:???:, немогу разобратьсяX)-. помогите ПЛИЗЗЗЗЗ :(
Код:
...
SECURITY_ATTRIBUTES sa;
sa.bInheritHandle=TRUE;
sa.lpSecurityDescriptor=NULL;
sa.nLength=sizeof(SECURITY_ATTRIBUTES);
...
HANDLE h1=CreateFile("D:\\testing\\out", GENERIC_WRITE, FILE_SHARE_WRITE, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,NULL);
...
SECURITY_ATTRIBUTES sa;
sa.bInheritHandle=TRUE;
sa.lpSecurityDescriptor=NULL;
sa.nLength=sizeof(SECURITY_ATTRIBUTES);
...
HANDLE h1=CreateFile("D:\\testing\\out", GENERIC_WRITE, FILE_SHARE_WRITE, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,NULL);
...