Salut,<br><br>Am incercat sa fac cum mi-ai sugerat .<br>Am facut un fisier comenzi.txt care arata asa :<br>=================================<br>ipconfig<br>notepad.exe<br>help<br>cls<br>quit<br>=================================<br>
Am rulat si am obtinut urmatorul rezultat :<br><br> =================================<br>C:\Documents and Settings\ana\My Documents\Downloads\codul meu -marti\codul meu<br>-marti>mini-shell.exe < comenzi.txt<br>><br>
Windows IP Configuration<br><br><br>Ethernet adapter Local Area Connection 3:<br><br> Connection-specific DNS Suffix . : <a href="http://jinny.ro">jinny.ro</a><br> IP Address. . . . . . . . . . . . : 192.168.2.154<br>
Subnet Mask . . . . . . . . . . . : 255.255.0.0<br> Default Gateway . . . . . . . . . : 192.168.0.1<br><br>Ethernet adapter Local Area Connection 4:<br><br> Media State . . . . . . . . . . . : Media disconnected<br>
<br>Ethernet adapter Local Area Connection 2:<br><br> Media State . . . . . . . . . . . : Media disconnected<br><br><br>> Assertion failed: false, file parser.y, line 529<br><br>This application has requested the Runtime to terminate it in an unusual way.<br>
Please contact the application's support team for more information.<br><br>C:\Documents and Settings\ana\My Documents\Downloads\codul meu -marti\codul meu<br>-marti><br>=================================<br><br><br>
Deci imi ruleaza prima coamnda si pe urma se blocheaza si imi apare eroarea de mai sus. Problema este in for-ul din main, nu la CreateProcess [am rulat separat ExecuteCommand pentru comenzile de mai sus si merge] , adica aici : <br>
<br>===============<br>/*! fn int main()<br> @brief mainul; este mini-shellul in care se ruleaza comenzile<br> @param fara parametri<br> @return 0 la succes; -1 la esec<br>*/<br>int main(void)<br>{<br> string line;<br>
command_t* root = NULL; <br><br> for (;;) {<br> cout << "> "; <br> getline(cin, line); <br> if ((line.length() == 0) && !cin.good()) {<br> // end of file reached<br>
cerr << "End of file!" << endl;<br> return EXIT_SUCCESS;<br> }<br><br> if (parse_line(line.c_str(), &root)) {<br> <br> if (root == NULL) {<br>
cout << "Command is empty!" << endl;<br> }<br> else {<br> // root points to a valid command tree<br> // that we can use<br> ExecuteCommand(root);<br>
<br> }<br> }<br> else {<br> // there was an error parsing the command<br> cout << "Error parsing!" << endl;<br> }<br> <br> cout << endl << endl;<br>
free_parse_memory(); <br> }<br>=====================<br><br>Sugestii? <br><br>Multumesc<br>Ana<br>332cc<br><br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML">
</div>