[so] comanda simpla windows

anda nenu aannddaa_92 at yahoo.com
Mon Mar 24 20:13:58 EET 2014


Buna, nu imi dau seama de ce nu merge urmatorul cod pentru executia unei comenzi simple (fiind la fel ca cel din laborator mi-am permis sa il scriu aici).

bool parse_simple(simple_command_t *s, int level, command_t *father, HANDLE *h)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwRet;
BOOL bRet;
HANDLE hFile;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));

si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);

si.dwFlags |= STARTF_USESTDHANDLES;

bRet = CreateProcess(NULL, get_argv(s), NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);    
DIE(bRet == FALSE, "Create Process");

dwRet = WaitForSingleObject(pi.hProcess, INFINITE);
DIE(dwRet == WAIT_FAILED, "WaitForSingleObject");

    CloseProcess(&pi);
}
Please help :D si am apelat-o asa 
if (c->op == OP_NONE) { 
        parse_simple(c->scmd,level,father,h);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20140324/283f36c9/attachment.html>


More information about the so mailing list