Get info from terminal
-
@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) -
See QProcess.
-
@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...)
-
Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!
-
@raf924 i am not realy sure how but i am going to try it. thnx
-
QProcess is your friend
-
@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.
-
@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. -
@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.
-
@raf924 thanks you very very much! i am going to test it out right now!