Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. problem with System()
Forum Updated to NodeBB v4.3 + New Features

problem with System()

Scheduled Pinned Locked Moved Unsolved General and Desktop
system commandsystem
37 Posts 5 Posters 12.7k Views 2 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.
  • jsulmJ jsulm

    @AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?

    AlvaroSA Offline
    AlvaroSA Offline
    AlvaroS
    wrote on last edited by
    #20

    @jsulm In a terminal if I write

    ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
    

    in /home/user1/ directory it runs good

    jsulmJ AlvaroSA 2 Replies Last reply
    0
    • AlvaroSA AlvaroS

      @jsulm In a terminal if I write

      ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
      

      in /home/user1/ directory it runs good

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #21

      @AlvaroS Then try what @mrjj suggested

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • mrjjM mrjj

        @AlvaroS

        Ok, you must debug then
        try to use
        http://doc.qt.io/qt-5/qprocess.html#error
        to see what it thinks.

        AlvaroSA Offline
        AlvaroSA Offline
        AlvaroS
        wrote on last edited by
        #22
        This post is deleted!
        mrjjM 1 Reply Last reply
        0
        • AlvaroSA AlvaroS

          @jsulm In a terminal if I write

          ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
          

          in /home/user1/ directory it runs good

          AlvaroSA Offline
          AlvaroSA Offline
          AlvaroS
          wrote on last edited by AlvaroS
          #23

          @AlvaroS said:

          @jsulm In a terminal if I write

          ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
          

          in /home/user1/ directory it runs good

          @jsulm said:

          @AlvaroS Then try what @mrjj suggested

          okey, it gives me UnknowError.... http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

          1 Reply Last reply
          0
          • AlvaroSA AlvaroS

            This post is deleted!

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #24

            @AlvaroS

            well you can use
            qDebug() "qproc: " << myProcess->error();

            and check the code in
            http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

            AlvaroSA 1 Reply Last reply
            1
            • mrjjM mrjj

              @AlvaroS

              well you can use
              qDebug() "qproc: " << myProcess->error();

              and check the code in
              http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

              AlvaroSA Offline
              AlvaroSA Offline
              AlvaroS
              wrote on last edited by
              #25

              @mrjj Yes thanks!! See my last post. Thanks again. It gives me Unknow error...

              mrjjM 1 Reply Last reply
              0
              • AlvaroSA AlvaroS

                @mrjj Yes thanks!! See my last post. Thanks again. It gives me Unknow error...

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #26

                @AlvaroS

                " This is the default return value of error()."

                You do call it AFTER u call
                myProcess->start(program,arguments); ?

                AlvaroSA 1 Reply Last reply
                1
                • mrjjM mrjj

                  @AlvaroS

                  " This is the default return value of error()."

                  You do call it AFTER u call
                  myProcess->start(program,arguments); ?

                  AlvaroSA Offline
                  AlvaroSA Offline
                  AlvaroS
                  wrote on last edited by
                  #27

                  @mrjj Yes:

                      myProcess->start(program, arguments);
                  
                      QProcess::ProcessError error = myProcess->error();
                  
                  mrjjM 1 Reply Last reply
                  0
                  • AlvaroSA AlvaroS

                    @mrjj Yes:

                        myProcess->start(program, arguments);
                    
                        QProcess::ProcessError error = myProcess->error();
                    
                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #28

                    @AlvaroS
                    hmm really odd then
                    it should say FailedToStart

                    Just to be 100% clear.

                    princi is never run ?

                    AlvaroSA 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      @AlvaroS
                      hmm really odd then
                      it should say FailedToStart

                      Just to be 100% clear.

                      princi is never run ?

                      AlvaroSA Offline
                      AlvaroSA Offline
                      AlvaroS
                      wrote on last edited by
                      #29

                      @mrjj said:

                      @AlvaroS
                      hmm really odd then
                      it should say FailedToStart

                      Just to be 100% clear.

                      princi is never run ?

                      okey look.
                      if I write:

                          myProcess->start(program, arguments);
                      
                          myProcess->waitForFinished(3000);
                      
                          QProcess::ProcessError error = myProcess->error();
                      
                      

                      Now error says:
                      QProcess::Crashed The process crashed some time after starting successfully.

                      1 Reply Last reply
                      0
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #30

                        so it sounds like your princi do run but it crashes?

                        oh. sorry my bad. start is async so calling error right after was
                        not correct.

                        waitForFinished fixed that.

                        AlvaroSA 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          so it sounds like your princi do run but it crashes?

                          oh. sorry my bad. start is async so calling error right after was
                          not correct.

                          waitForFinished fixed that.

                          AlvaroSA Offline
                          AlvaroSA Offline
                          AlvaroS
                          wrote on last edited by
                          #31

                          @mrjj Yes... I think so...
                          How should I pass the arguments?

                          the arguments of princi are:

                          0 wps.front().x() wps.front().y() 0 wps.back().x() wps.front().y() prueba_princi.bmp 0 0 +
                          

                          so my QStringList arguments is:

                           QStringList arguments;
                          arguments << "0" << QString::number(wps.front().x()) << QString::number(wps.front().y()) << "0" << QString::number(wps.back().x()) << QString::number(wps.back().y()) << "prueba_princi.bmp" << "0" << "0" << "+" ;
                          
                          
                          1 Reply Last reply
                          0
                          • mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #32

                            it seems fine
                            You should look inside princi for how it
                            reads it. it must be that part that is crashing ?

                            AlvaroSA 2 Replies Last reply
                            0
                            • mrjjM mrjj

                              it seems fine
                              You should look inside princi for how it
                              reads it. it must be that part that is crashing ?

                              AlvaroSA Offline
                              AlvaroSA Offline
                              AlvaroS
                              wrote on last edited by
                              #33

                              @mrjj yes, but it really rare that if I run from terminal princi runs good...

                              1 Reply Last reply
                              0
                              • mrjjM mrjj

                                it seems fine
                                You should look inside princi for how it
                                reads it. it must be that part that is crashing ?

                                AlvaroSA Offline
                                AlvaroSA Offline
                                AlvaroS
                                wrote on last edited by AlvaroS
                                #34

                                @mrjj And if I write:

                                system ("./princi 0 5 10 0 7 8 prueba_princi.bmp 0 0 +")
                                where 5,10,7 and 8 are wps.front,wps.back....
                                it runs well...

                                mrjjM 1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #35

                                  What is that + sign doing as parameter ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  AlvaroSA 1 Reply Last reply
                                  1
                                  • SGaistS SGaist

                                    What is that + sign doing as parameter ?

                                    AlvaroSA Offline
                                    AlvaroSA Offline
                                    AlvaroS
                                    wrote on last edited by
                                    #36

                                    @SGaist + is just and argument that i have to pass to princi

                                    1 Reply Last reply
                                    0
                                    • AlvaroSA AlvaroS

                                      @mrjj And if I write:

                                      system ("./princi 0 5 10 0 7 8 prueba_princi.bmp 0 0 +")
                                      where 5,10,7 and 8 are wps.front,wps.back....
                                      it runs well...

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #37

                                      @AlvaroS
                                      well you must debug it then.
                                      Try to qDebug inside princi what you read and compare that to what u read for
                                      system ("./princi 0 5 10 0 7 8 prueba_princi.bmp 0 0 +")

                                      Sadly We cannot guess why you crash from the code shown.

                                      Also you dump the arguments to qDebug before u
                                      call start, just to see what u are sending also.

                                      and then take it from there.

                                      1 Reply Last reply
                                      1

                                      • Login

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