Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Get info from terminal
I want to get the results temp from "nvidia-settings -q gpucoretemp"
~ $ nvidia-settings -q gpucoretemp
Attribute 'GPUCoreTemp' (Z68X-UD3P-B3:0.0): 46.
'GPUCoreTemp' is an integer attribute.
'GPUCoreTemp' is a read-only attribute.
'GPUCoreTemp' can use the following target types: X Screen, GPU.
So what i need is to take the temp (it is 46 right now) and make the program update at every sec
can someone help me?
Shouldn't you rather use the nvidia management library for that task ?
@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)
@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...)
@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.
raf924 last edited by raf924
@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!