<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Salut,<br><br>Am urmatorul cod si observ ca dupa ce dau o comanda, nu mai pot scrie nimic la standard input.<br>Am incercat mai multe variante pt citire, dar toate au probleme. Astfel:<br><br>ReadFile, citeste si executa o comanda, apoi imi intoarce inputul caracter cu caracter (nu mai asteapta pana la newline).<br>scanf("%[^\n",buffer); // citeste o comanda, apoi executa aceeasi comanda la infinit<br><br>#include<iostream><br>#include<windows.h><br>#include<string><br><br>using namespace std;<br><br>int main(){<br> PROCESS_INFORMATION pi = {0};<br> STARTUPINFO si = {0};<br> string line;<br> while(1){<br> getline(cin,line);<br>
if(CreateProcess(0,(LPSTR)line.c_str(),0,0,false,CREATE_NEW_PROCESS_GROUP,0,0,&si,&pi)){<br> CloseHandle(pi.hThread);<br> WaitForSingleObject(pi.hProcess, INFINITE);<br> CloseHandle(pi.hProcess);<br> }<br> }<br> return 0;<br>}<br><br>Mai trebuie setate niste flaguri la crearea procesului?<br><br>Multumesc,<br>Stefan<br></div>
</div><br>
</body></html>