You are probably looking for the following:
[static] QString QHostInfo :: localHostName ()
Returns the host name of this device.
main.cpp
#include <QHostInfo> #include <QDebug> int main() { qDebug() << QHostInfo::localHostName(); return 0; }
main.pro
TEMPLATE = app TARGET = main QT = core network SOURCES += main.cpp
Assembly and launch
qmake && make && ./main
Exit
"myhostname"
lpapp source share