⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inet_netoa_rtest.c

📁 p2p类源代码 kadc协议官方源代码
💻 C
字号:
/* works on both SunOS4 (iSunSPARC, big-endian) and Linux (i386, little-endian) */#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>static void inet_ntoa_r(char *ip, struct in_addr sin_addr) {        unsigned char *b = (unsigned char *)&sin_addr;        sprintf(ip, "%d.%d.%d.%d", b[0], b[1], b[2], b[3]);}int main(int ac, char *av[]) {        char s[32];        struct in_addr ia;        ia.s_addr = htonl(0x01020304);        inet_ntoa_r(s, ia);        printf("inet_ntoa_r() for 0x01020304 sets s to %s\n", s);        printf("inet_ntoa()   for 0x01020304 sets s to %s\n", inet_ntoa(ia));        return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -