你提到的 copendir 其实应该是 opendir(或可能是 closedir / readdir 的误写)。
严格说,opendir 是 POSIX 标准函数,并不是 Debian 独有的。
只要实现了 POSIX / SUS 标准的系统,基本都能用 opendir,而不只是 Debian。
opendir 的系统(非 Debian)opendirFindFirstFile / FindNextFile#include <dirent.h>
#include <stdio.h>
int main() {
DIR *dir = opendir(".");
if (!dir) return 1;
struct dirent *entry;
while ((entry = readdir(dir)))
printf("%s\n", entry->d_name);
closedir(dir);
return 0;
}
不是“Debian 才能用
opendir”,而是“支持 POSIX 的系统都能用”。
如果你是在考虑 替代 Debian 的系统,上面列出的 Linux 发行版和 BSD 系统 都可以直接用。
如果你能说清楚:
我可以给你更精确的建议。