Buna!<br><br>Daca imi aduc aminte bine, problema ar fi din cauza ca trebuie ca root=NULL cand e pasat ca parametru lui parse_line (parca chiar asta era asertul respectiv).<br><br><br><div class="gmail_quote">On Wed, Aug 5, 2009 at 2:04 PM, ana-maria lepar <span dir="ltr"><<a href="mailto:amylepar@gmail.com">amylepar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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" target="_blank">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 type="hidden"><input type="hidden"><div>
</div>
<br>_______________________________________________<br>
so mailing list<br>
<a href="mailto:so@cursuri.cs.pub.ro">so@cursuri.cs.pub.ro</a><br>
<a href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so" target="_blank">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so</a><br>
<br></blockquote></div><br>