gethostbyname:Operation not permitted

zyc_glboy 2012-04-05 11:06:32
RT
code:

rc = gethostname(hname, sizeof(hname));
if (rc == -1) {
printf("%s: failed in gethostname,lien=%d,%s\n", __FUNCTION__, __LINE__, strerror(errno));
return -1;
}
printf("hostname is %s\n", hname);

ht = gethostbyname(hname);
if (ht == NULL) {
printf("%s: failed in gethostbyname,line=%d,%s\n", __FUNCTION__, __LINE__, strerror(h_errno));
return -1;
}


请高手指教~~~~~~
...全文
204 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2012-04-05
  • 打赏
  • 举报
回复
权限不够?
zyc_glboy 2012-04-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

google gethostbyname:Operation not permitted

http://hi.baidu.com/atomxu/blog/item/782772083739e0a52eddd487.html
[/Quote]

打印信息确实不对 是Unkown host
fishion 2012-04-05
  • 打赏
  • 举报
回复
.信息不足,在MSDN和网上的例子都差不多,没看出来有什么问题
pengfoo 2012-04-05
  • 打赏
  • 举报
回复
google gethostbyname:Operation not permitted

http://hi.baidu.com/atomxu/blog/item/782772083739e0a52eddd487.html
cikerexue 2012-04-05
  • 打赏
  • 举报
回复
运行时加权限?

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧