Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. QProcess cmd & tptf
Forum Updated to NodeBB v4.3 + New Features

QProcess cmd & tptf

Scheduled Pinned Locked Moved Unsolved Italian
4 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bruschetta
    wrote on last edited by
    #1

    Sto cercando di lanciare da programma la shell di windows e,da li,lanciare un comando tftp...
    Sto documentandomi un po' ma non capisco in cosa stia sbagliando.

    Se ad esempio utilizzo questo comando

    QProcess process;
    process.start("cmd.exe /C start C:/Users/user/Desktop/configINPUT.txt");
    process.waitForFinished();
    

    Riesco ad aprire il file tranquillamente
    Se però al posto del file cerco di lanciare un comando tftp non succede niente..

      QProcess process;
       process.start("cmd.exe /C start tftp -i 192.168.2.1 get configINPUT.txt");
       process.waitForFinished();
    

    Che cosa sto sbagliando? Grazie in anticipo per l'aiuto..

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Doveresti usare una QStringList invece di passare tutti gli argomenti in una sola riga http://doc.qt.io/qt-5/qprocess.html#start

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bruschetta
        wrote on last edited by
        #3

        In realtà ho provato anche questa forma...

        QProcess process;
            QString program = "cmd"; //or cmd.exe but nothing changed
            QStringList arguments = QStringList();
        
            arguments<< "tftp";
            arguments<< "-i";
            arguments<< "192.168.2.1";
            arguments<< "get";
            arguments<< "configINPUT.txt";
            process.setWorkingDirectory(temp_path);
            process.start(program,arguments);
            qDebug()<<arguments;
            process.waitForFinished();
        

        Però continua a non voler interpretare il comando

        1 Reply Last reply
        0
        • mrdebugM Offline
          mrdebugM Offline
          mrdebug
          wrote on last edited by
          #4

          Ciao, non usare waitForFinished().
          Ti consiglio di implementare gli sots

          void finished(int exitCode, QProcess::ExitStatus exitStatus);
          void readyReadStandardError();
          void readyReadStandardOutput();

          vedrai che poi ti funziona.

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved