findfirst函数的用法
函数名称: findfirst
int findfirst(char *pathname,struct ffblk *ffblk,int attrib)查找指定的文件,成功
返回0 pathname为指定的目录名和文件名,如"C://WPS//TXT" ffblk为指定的保存文件信息的一个结构,定义如下: ┏━━━━━━━━━━━━━━━━━━┓ ┃struct ffblk ┃ ┃{ ┃ ┃ char ff_reserved[21]; /*DOS保留字*/┃ ┃ char ff_attrib; /*文件属性*/ ┃ ┃ int ff_ftime; /*文件时间*/ ┃ ┃ int ff_fdate; /*文件日期*/ ┃ ┃ long ff_fsize; /*文件长度*/ ┃ ┃ char ff_name[13]; /*文件名*/ ┃ ┃} ┃ ┗━━━━━━━━━━━━━━━━━━┛ attrib为文件属性,由以下字符代表 ┏━━━━━━━━━┳━━━━━━━━┓ ┃FA_RDONLY 只读文件┃FA_LABEL 卷标号┃ ┃FA_HIDDEN 隐藏文件┃FA_DIREC 目录 ┃ ┃FA_SYSTEM 系统文件┃FA_ARCH 档案 ┃ ┗━━━━━━━━━┻━━━━━━━━┛ 例: struct ffblk ff; findfirst("*.wps",&ff,FA_RDONLY);
这只限于windows ,而在linux下使用打开文件夹 要用opendir ,头文件是dirent.h
|