Qt 域名转成IP
2024-10-16 03:41:33
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <arpa/inet.h>
struct hostent *h;
QByteArray ba = ui->lineEdit->text().toLatin1();
h = gethostbyname(ba.data());
if(h == NULL)
{
qDebug()<<"get hostbyname error!";
exit();
} struct in_addr *in=(in_addr *)h->h_addr;
char *ch = inet_ntoa(*in);
QString str = QString(QLatin1String(ch));
qDebug()<<"IP Address:"<<str;
ui->lineEdit_2->setText(str);
最新文章
- HBase如何选取split point
- 行列式计算(C#)
- 自动更新Chromium
- 使用 flow.ci 实现 Android 自动化测试与持续集成
- Codeforces Round #227 (Div. 2) E. George and Cards set内二分+树状数组
- $_POST 变量以及$GLOBALS[&#39;HTTP_RAW_POST_DATA&#39;]
- DataGridView中添加CheckBox列用于选择行
- log4j输出日志乱码(转)
- android中actionbar的title居中
- android优化从网络中加载图片速度。。
- C# Attribute
- 获取web路径的几种方式
- C#:占位符的例子
- 新建一个类并绑定一个activity
- 机器时代的中国字幕(Automata.2014.720p.WEB-DL.DD5.1.H264-RARBG.srt)
- probabilistic robotics_Kalman filter(一)
- Python中编码的详细讲解
- ASCII,Unicode,GBK和UTF-8字符编码的区别和联系
- 红米note3发热严重,小米真垃圾!
- Luogu4606 SDOI2018 战略游戏 圆方树、虚树、链并