本文介绍了字符串到IP地址.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C ++中使函数将字符串转换为ipaddress或是否有任何内置函数来执行此操作. (例如atoi)plz帮助...
how to make a function convert string into ipaddress in c++ or is there any inbuilt function to do this. (like atoi) plz help...
推荐答案
int rc;
int s;
struct sockaddr_in myname;
/* clear the structure to be sure that the sin_zero field is clear */
memset(&myname, 0, sizeof(myname));
myname.sin_family = AF_INET;
myname.sin_addr = inet_addr("129.5.24.1");
myname.sin_port = htons(1024);
这篇关于字符串到IP地址.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!