1、strcasecmp 字符串比较(不区分大小写)
2、判断文件是否存在
1)access接口
if(access(name,F_OK)==0){
printf("文件存在\n");
} else {
printf("文件不存在\n");
}
2)stat
if (stat(namelist[num]->d_name, &tStat) == 0) {
if (S_ISDIR(tStat.st_mode)) {
printf("%s is dirent\n", namelist[num]->d_name);
} else if (S_ISREG(tStat.st_mode)) {
printf("%s is file\n", namelist[num]->d_name);
}
}
3、chdir(dir) 切换工作目录