c-socket-programming:inet_ntop
تفاوتها
تفاوت دو نسخهٔ متفاوت از صفحه را مشاهده میکنید.
| نگارش بعد | نگارش قبل | ||
| c-socket-programming:inet_ntop [2024/06/18 00:58] – ایجاد شد pejman | c-socket-programming:inet_ntop [2024/06/18 22:55] (فعلی) – pejman | ||
|---|---|---|---|
| خط 11: | خط 11: | ||
| <code C> | <code C> | ||
| + | // inet_ntop-ipv4.c | ||
| + | // gcc -std=c99 -Wall -Wextra -Werror -pedantic -o inet_ntop-ipv4 inet_ntop-ipv4.c | ||
| + | |||
| #include < | #include < | ||
| #include < | #include < | ||
| خط 16: | خط 19: | ||
| int main() | int main() | ||
| { | { | ||
| + | struct in_addr ia; | ||
| - | struct in_addr | + | |
| + | char ipv4[INET_ADDRSTRLEN]; | ||
| - | | + | inet_ntop(AF_INET, |
| - | char ipv4[INET_ADDRSTRLEN]; | + | |
| - | inet_ntop(AF_INET, &ia, ipv4, INET_ADDRSTRLEN); | + | printf("ipv4 : %s\n", ipv4); |
| - | printf(" | + | |
| - | + | ||
| - | | + | |
| } | } | ||
| </ | </ | ||
| خط 39: | خط 41: | ||
| <code C> | <code C> | ||
| + | // inet_ntop-ipv6.c | ||
| + | // gcc -std=c99 -Wall -Wextra -Werror -pedantic -o inet_ntop-ipv6 inet_ntop-ipv6.c | ||
| + | |||
| #include < | #include < | ||
| #include < | #include < | ||
c-socket-programming/inet_ntop.1718659683.txt.gz · آخرین ویرایش: 2024/06/18 00:58 توسط pejman
