检查变量是否包含c中的任何ipv6地址

时间:2017-07-24 12:27:19

标签: c

让我们假设一个结构

struct in6_addr
{
    unsigned char s6_addr[16];
}x;

s6_addr包含二进制形式的任何ipv6地址。现在我想检索该ipv6地址并以人类可读的格式打印。我知道以人类可读的形式打印ipv6地址我们使用inet_ntop()。但在打印ipv6地址之前或使用inet_ntop()之前,我只想确保此变量包含任何ipv6地址或任何值,然后仅使用inet_ntop()

 if(/* Condition */)
 {
 /* if condition becomes true then only use inet_ntop() */
     inet_ntop();
 }

0 个答案:

没有答案