#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);

最新文章

  1. HBase如何选取split point
  2. 行列式计算(C#)
  3. 自动更新Chromium
  4. 使用 flow.ci 实现 Android 自动化测试与持续集成
  5. Codeforces Round #227 (Div. 2) E. George and Cards set内二分+树状数组
  6. $_POST 变量以及$GLOBALS[&#39;HTTP_RAW_POST_DATA&#39;]
  7. DataGridView中添加CheckBox列用于选择行
  8. log4j输出日志乱码(转)
  9. android中actionbar的title居中
  10. android优化从网络中加载图片速度。。
  11. C# Attribute
  12. 获取web路径的几种方式
  13. C#:占位符的例子
  14. 新建一个类并绑定一个activity
  15. 机器时代的中国字幕(Automata.2014.720p.WEB-DL.DD5.1.H264-RARBG.srt)
  16. probabilistic robotics_Kalman filter(一)
  17. Python中编码的详细讲解
  18. ASCII,Unicode,GBK和UTF-8字符编码的区别和联系
  19. 红米note3发热严重,小米真垃圾!
  20. Luogu4606 SDOI2018 战略游戏 圆方树、虚树、链并

热门文章

  1. pl/sql的工具导入和代码导入
  2. json数据返回
  3. CHAR数组转成STRING:C++
  4. MySQL重构查询的方式
  5. 一句JS搞定只允许输入数字和字母
  6. String对象
  7. Windows坐标系
  8. Tuple初探
  9. Centos7 wget和普通下载有区别
  10. 转:CFile::Seek