Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Get info from terminal
Forum Updated to NodeBB v4.3 + New Features

Get info from terminal

Scheduled Pinned Locked Moved 3rd Party Software
linuxterminalgettextnvidia-settings
12 Posts 3 Posters 5.2k 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.
  • S SGaist
    1 Aug 2015, 20:37

    Hi,

    Shouldn't you rather use the nvidia management library for that task ?

    ? Offline
    ? Offline
    A Former User
    wrote on 1 Aug 2015, 23:21 last edited by
    #3

    @SGaist oh yea i forgot about that!
    But my problem is how do i use the commands to get the text and place the result on a label (i only want to get the temp nothing else)

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raf924
      wrote on 2 Aug 2015, 06:05 last edited by
      #4

      See QProcess.

      ? 1 Reply Last reply 2 Aug 2015, 15:30
      0
      • R raf924
        2 Aug 2015, 06:05

        See QProcess.

        ? Offline
        ? Offline
        A Former User
        wrote on 2 Aug 2015, 15:30 last edited by
        #5

        @raf924 I don’t know how to get a specific area of the text i only want to pick the temp.(its the first time i am making a program that collects info from the system so i am bad at it...)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raf924
          wrote on 2 Aug 2015, 16:41 last edited by
          #6

          Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!

          ? 1 Reply Last reply 2 Aug 2015, 18:56
          0
          • R raf924
            2 Aug 2015, 16:41

            Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!

            ? Offline
            ? Offline
            A Former User
            wrote on 2 Aug 2015, 18:56 last edited by
            #7

            @raf924 i am not realy sure how but i am going to try it. thnx

            R 1 Reply Last reply 2 Aug 2015, 19:54
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 2 Aug 2015, 19:42 last edited by
              #8

              QProcess is your friend

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

              1 Reply Last reply
              0
              • ? A Former User
                2 Aug 2015, 18:56

                @raf924 i am not realy sure how but i am going to try it. thnx

                R Offline
                R Offline
                raf924
                wrote on 2 Aug 2015, 19:54 last edited by
                #9

                @BillGR17 If you're really stuck (although it's really not that complicated), I can give you the basic 3-4 lines of code but I believe it's always better to figure things out yourself instead of just copy-pasting code.

                ? 1 Reply Last reply 2 Aug 2015, 21:00
                0
                • R raf924
                  2 Aug 2015, 19:54

                  @BillGR17 If you're really stuck (although it's really not that complicated), I can give you the basic 3-4 lines of code but I believe it's always better to figure things out yourself instead of just copy-pasting code.

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on 2 Aug 2015, 21:00 last edited by
                  #10

                  @raf924 yes i am really stuck.
                  The only example that i know is with txt and not with terminal.
                  I can take all the help u give me right now.

                  R 1 Reply Last reply 2 Aug 2015, 21:10
                  0
                  • ? A Former User
                    2 Aug 2015, 21:00

                    @raf924 yes i am really stuck.
                    The only example that i know is with txt and not with terminal.
                    I can take all the help u give me right now.

                    R Offline
                    R Offline
                    raf924
                    wrote on 2 Aug 2015, 21:10 last edited by raf924 8 Feb 2015, 23:59
                    #11

                    @BillGR17 Have you even visited the links I gave you? Anyway here are the basic instructions

                    QProcess nvidia;
                    nvidia.start("nvidia-settings", QStringList()<< "-q" << "gpucoretemp");
                    nvidia.waitForFinished();
                    QByteArray output = nvidia.readLine();
                    int temp = QString(ouput).split(":").last().toInt();
                    

                    You might have to tweak the code a bit, I just put that together I don't know that it will compile but I don't see why it wouldn't.

                    ? 1 Reply Last reply 2 Aug 2015, 21:21
                    0
                    • R raf924
                      2 Aug 2015, 21:10

                      @BillGR17 Have you even visited the links I gave you? Anyway here are the basic instructions

                      QProcess nvidia;
                      nvidia.start("nvidia-settings", QStringList()<< "-q" << "gpucoretemp");
                      nvidia.waitForFinished();
                      QByteArray output = nvidia.readLine();
                      int temp = QString(ouput).split(":").last().toInt();
                      

                      You might have to tweak the code a bit, I just put that together I don't know that it will compile but I don't see why it wouldn't.

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on 2 Aug 2015, 21:21 last edited by
                      #12

                      @raf924 thanks you very very much! i am going to test it out right now!

                      1 Reply Last reply
                      0

                      12/12

                      2 Aug 2015, 21:21

                      • Login

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