C语言目录操作

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>

创新互联建站2013年开创至今,先为府谷等服务建站,府谷等地企业,进行企业商务咨询服务。为府谷企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

int main(void)
{
DIR dir = NULL;
struct dirent
ptr = (struct dirent )calloc(1, sizeof(struct dirent));
struct dirent
result = NULL;

dir = opendir("/root/tmp");
if (!dir) {
    printf ("opendir failed\n");
    return 1;
}

while ((readdir_r(dir, ptr, &result)==0) && (result != NULL)) {
    printf ("name:%s\n", result->d_name);
}
closedir(dir);

return 0;

}

分享标题:C语言目录操作
网页URL:https://www.cdcxhl.com/article32/pddpsc.html

成都网站建设公司_创新互联,为您提供品牌网站设计App设计ChatGPT网站设计公司全网营销推广网页设计公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

外贸网站制作