Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set ip address to a computer in Qt (Solved)
Forum Updated to NodeBB v4.3 + New Features

How to set ip address to a computer in Qt (Solved)

Scheduled Pinned Locked Moved Mobile and Embedded
32 Posts 4 Posters 12.8k 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.
  • H Offline
    H Offline
    houmingc
    wrote on 27 Jan 2015, 09:34 last edited by
    #21

    it works when i do a sudo su
    it doesn't work without permission, what should i do next?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 27 Jan 2015, 09:40 last edited by
      #22

      It does work for me from the App and Outside
      @
      args<<"-c"<<
      "sudo -S ifconfig eth0 192.168.100.21</home/ubuntu/passwd.txt";
      @

      There should be a space before and after < in above command.

      157

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p3c0
        Moderators
        wrote on 27 Jan 2015, 09:40 last edited by
        #23

        It does work for me from the App and Outside
        @
        args<<"-c"<<
        "sudo -S ifconfig eth0 192.168.100.21</home/ubuntu/passwd.txt";
        @

        There should be a space before and after < in above command.

        157

        1 Reply Last reply
        0
        • H Offline
          H Offline
          houmingc
          wrote on 27 Jan 2015, 09:41 last edited by
          #24

          under /opt
          cat >password.txt 'Key in my password'
          cat password 'Check my password'

          its work, thanks alot :>>

          1 Reply Last reply
          0
          • H Offline
            H Offline
            houmingc
            wrote on 27 Jan 2015, 09:41 last edited by
            #25

            under /opt
            cat >password.txt 'Key in my password'
            cat password 'Check my password'

            its work, thanks alot :>>

            1 Reply Last reply
            0
            • P Offline
              P Offline
              p3c0
              Moderators
              wrote on 27 Jan 2015, 09:52 last edited by
              #26

              Well then get the errors using readyReadStandardError() signal if any.

              157

              1 Reply Last reply
              0
              • P Offline
                P Offline
                p3c0
                Moderators
                wrote on 27 Jan 2015, 09:52 last edited by
                #27

                Well then get the errors using readyReadStandardError() signal if any.

                157

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  houmingc
                  wrote on 27 Jan 2015, 10:01 last edited by
                  #28

                  what does "-c" in front of "sudo -s" meant or used for??

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    houmingc
                    wrote on 27 Jan 2015, 10:01 last edited by
                    #29

                    what does "-c" in front of "sudo -s" meant or used for??

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      p3c0
                      Moderators
                      wrote on 27 Jan 2015, 10:23 last edited by
                      #30

                      It is for sh so that it reads commands from argument strings. Check "this":http://manpages.ubuntu.com/manpages/utopic/en/man1/sh.1posix.html man page for more details. I hope your system has sh command.

                      157

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        p3c0
                        Moderators
                        wrote on 27 Jan 2015, 10:23 last edited by
                        #31

                        It is for sh so that it reads commands from argument strings. Check "this":http://manpages.ubuntu.com/manpages/utopic/en/man1/sh.1posix.html man page for more details. I hope your system has sh command.

                        157

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          houmingc
                          wrote on 9 Jun 2015, 07:03 last edited by houmingc 6 Sept 2015, 07:04
                          #32

                          QProcess Class is used to start external programs and to communicate with them.
                          create a new QProcess and input args to /bin/sh.
                          Below code has been tested working.
                          Thanks to p3c0, if not, answer below will not be available :

                          QProcess *myProcess = new QProcess;
                          QStringList args;
                          args<"-c"<<"sudo -S ifconfig eth0 192.168.100.1 < /var/passwd.txt");
                          myProcess->start("/bin/sh",args);
                          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