?? ipformat.cc
字號:
#include <iostream>using namespace std;#include <arpa/inet.h>void showbytes(void* addr, int size){ unsigned char* p=(unsigned char*)addr; for(int i=0; i<size; i++) cout << hex << (int)*p++ << ' '; cout << endl;}int main(){ char* p="192.168.0.23"; int n; inet_pton(AF_INET, p, &n); showbytes(&n, sizeof(n)); char buf[100]; inet_ntop(AF_INET, &n, buf, 100); cout << buf << endl;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -