gethostbyname xcode 问题
嘿伙计们,我是这方面的新手,但我正在尝试使用 gethostname() 来使用 xcode 和 ipad。我尝试了一些方法,但它们似乎都冻结了。
所以当我这样做时:
host = gethostbyname("website.com");
效果很好。不过,我希望能够从程序内更改网站。
我尝试过:
const char *server = [Website_NSString UTF8String];
host = gethostbyname(server);
const char *server = [Website_NSString cStringUsingEncoding:NSASCIIStringEncoding];
host = gethostbyname(server);
const char *server[256];
[Website_NSString getCString:server maxLength:256 encoding:NSASCIIStringEncoding];
host = gethostbyname(Website_NSString);
他们
host = gethostbyname(Website_NSString);
要么提出警告:从不兼容的指针类型传递'gethostbyname'的参数1,要么根本没有警告。但每次应用程序都会冻结。请帮忙。
Hey guys, I'm new at this stuff, but I'm trying to use gethostname() to work using xcode and the ipad. I've tried a couple of things, but they all seem to freeze up.
So when I just do:
host = gethostbyname("website.com");
that works fine. I'd like to be able to change the website from within the program though.
I've tried:
const char *server = [Website_NSString UTF8String];
host = gethostbyname(server);
const char *server = [Website_NSString cStringUsingEncoding:NSASCIIStringEncoding];
host = gethostbyname(server);
const char *server[256];
[Website_NSString getCString:server maxLength:256 encoding:NSASCIIStringEncoding];
host = gethostbyname(Website_NSString);
and
host = gethostbyname(Website_NSString);
They've either come up with a the warning: Passing argument 1 of 'gethostbyname' from incompatible pointer type, or no warning at all. Still everytime the app just freezes. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是个白痴。如果我这样做:
效果很好。
I'm an idiot. If I do:
It works fine.