[so] Tema1 - Problema mini-shell Windows la citirea / executarea	comenzilor simple
    ana-maria lepar 
    amylepar at gmail.com
       
    Wed Aug  5 14:04:45 EEST 2009
    
    
  
Salut,
Am incercat sa fac cum mi-ai sugerat .
Am facut un fisier comenzi.txt  care arata asa :
=================================
ipconfig
notepad.exe
help
cls
quit
=================================
Am rulat si am obtinut urmatorul rezultat :
  =================================
C:\Documents and Settings\ana\My Documents\Downloads\codul meu -marti\codul
meu
-marti>mini-shell.exe < comenzi.txt
>
Windows IP Configuration
Ethernet adapter Local Area Connection 3:
        Connection-specific DNS Suffix  . : jinny.ro
        IP Address. . . . . . . . . . . . : 192.168.2.154
        Subnet Mask . . . . . . . . . . . : 255.255.0.0
        Default Gateway . . . . . . . . . : 192.168.0.1
Ethernet adapter Local Area Connection 4:
        Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 2:
        Media State . . . . . . . . . . . : Media disconnected
> Assertion failed: false, file parser.y, line 529
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
C:\Documents and Settings\ana\My Documents\Downloads\codul meu -marti\codul
meu
-marti>
=================================
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 :
===============
/*! fn int main()
    @brief mainul; este mini-shellul in care se ruleaza comenzile
    @param fara parametri
    @return 0 la succes; -1 la esec
*/
int main(void)
{
    string line;
    command_t* root = NULL;
    for (;;) {
        cout << "> ";
        getline(cin, line);
        if ((line.length() == 0) && !cin.good()) {
            // end of file reached
            cerr << "End of file!" << endl;
            return EXIT_SUCCESS;
        }
        if (parse_line(line.c_str(), &root)) {
            if (root == NULL) {
                cout << "Command is empty!" << endl;
            }
            else {
                // root points to a valid command tree
                // that we can use
                ExecuteCommand(root);
            }
        }
        else {
            // there was an error parsing the command
            cout << "Error parsing!" << endl;
        }
        cout << endl << endl;
        free_parse_memory();
    }
=====================
Sugestii?
Multumesc
Ana
332cc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090805/c99e7938/attachment.htm>
    
    
More information about the so
mailing list