How to get the host name of my desktop PC?
Like this, to get system information for Symbian OS:
http://developer.nokia.com/community/wiki/Get_device_information_using_Qt
you know that class QHostInfo?
http://doc.qt.io/qt-4.8/qhostinfo.html
qDebug(QHostInfo::localHostName().toLocal8Bit());
You are probably look for this:
[static] QString QHostInfo::localHostName()
Returns the host name of this machine.
#include <QHostInfo>
#include <QDebug>
int main()
{
qDebug() << QHostInfo::localHostName();
return 0;
}
TEMPLATE = app
TARGET = main
QT = core network
SOURCES += main.cpp
qmake && make && ./main
"myhostname"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With