---
name: "kdk_nc_freeall"
section: "3"
platform: "linux"
package: "libkysdk-system"
version: "3.0.1.4-1"
release: "Arch Linux 2026-11-07"
platforms: ["linux"]
url: "https://carta.tech/man/kdk_nc_freeall"
---

# kdk\_nc\_freeall(3)

用于回收字符串列表

## NAME

kdk\_nc\_freeall - 用于回收字符串列表

## SYNOPSIS

```
#include <libkync.h>

extern inline void kdk_nc_freeall(char **ptr);

Link with -lkyhw.
```

## Detailed Description

The main function of the interface is to recycle a list of strings of type char \*\*.

The argument *ptr* is a list of strings of type char \*\*.

## RETURN VALUE

No return value

## EXAMPLES

```
#include "libkync.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char **cards = kdk_nc_get_cardlist();
    size_t index = 0;
    printf("所有网卡：\n");
    while (cards[index])
    {
        char *mac = kdk_nc_get_phymac(cards[index]);
        char *ipv4 = kdk_nc_get_private_ipv4(cards[index]);
        char *ipv6 = kdk_nc_get_private_ipv6(cards[index]);
        char *driver = kdk_nc_get_driver(cards[index]);
        char vendor[256] = " ", product[256] = " ";
        kdk_nc_get_vendor_and_product(cards[index], vendor, product);
        printf("Card %zd: %s Status: %s Mac: %s IPv4: %s IPv6: %s  Vendor: %s  Product: %s  Type: %s  driver: %s\n",
               index + 1, cards[index], kdk_nc_is_up(cards[index]) == 1 ? "Up" : "Down",
               mac, ipv4, ipv6, vendor, product,
               kdk_nc_is_wireless(cards[index]) ? "wireless" : "ethernet", driver);
        char **list4 = kdk_nc_get_ipv4(cards[index]);
        int i = 0;
        printf("AllIpV4: ");
        while (list4 && list4[i])
        {
            printf("%s ", list4[i++]);
        }
        printf("\n");
        char **list6 = kdk_nc_get_ipv6(cards[index]);
        printf("AllIpV6: ");
        i = 0;
        while (list6 && list6[i])
        {
            printf("%s ", list6[i++]);
        }
        printf("\n");
        free(mac);
        free(ipv4);
        free(ipv6);
        free(list4);
        free(list6);
        free(driver);
        index++;
    }
    kdk_nc_freeall(cards);
    char **upcards = kdk_nc_get_upcards();
    index = 0;
    printf("工作网卡：\n");
    while (upcards[index])
    {
        printf("Card %zd: %s\n", index + 1, upcards[index]);
        index++;
    }
    kdk_nc_freeall(upcards);
    return 0;
}
```

## CONFORMING TO

These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: **kdk\_nc\_is\_up**(), **kdk\_nc\_get\_upcards**(), **kdk\_nc\_get\_cardlist**(), **kdk\_nc\_get\_private\_ipv4**(), **kdk\_nc\_get\_ipv4**(), **kdk\_nc\_get\_private\_ipv6**(), **kdk\_nc\_get\_ipv6**(), **kdk\_nc\_is\_wireless**(), **kdk\_nc\_get\_vendor\_and\_product**(), **kdk\_nc\_get\_phymac**(), and **kdk\_nc\_get\_driver**().

## SEE ALSO

[**kdk\_nc\_is\_up**(3)](/man/kdk_nc_is_up/3.md), [**kdk\_nc\_get\_upcards**(3)](/man/kdk_nc_get_upcards/3.md), [**kdk\_nc\_get\_cardlist**(3)](/man/kdk_nc_get_cardlist/3.md), [**kdk\_nc\_get\_private\_ipv4**(3)](/man/kdk_nc_get_private_ipv4/3.md), [**kdk\_nc\_get\_ipv4**(3)](/man/kdk_nc_get_ipv4/3.md), [**kdk\_nc\_get\_private\_ipv6**(3)](/man/kdk_nc_get_private_ipv6/3.md), [**kdk\_nc\_get\_ipv6**(3)](/man/kdk_nc_get_ipv6/3.md), [**kdk\_nc\_is\_wireless**(3)](/man/kdk_nc_is_wireless/3.md), [**kdk\_nc\_get\_vendor\_and\_product**(3)](/man/kdk_nc_get_vendor_and_product/3.md), [**kdk\_nc\_get\_phymac**(3)](/man/kdk_nc_get_phymac/3.md), and [**kdk\_nc\_get\_driver**(3)](/man/kdk_nc_get_driver/3.md).
