c语言函数 findfirst(),_findfirst()的区别

来源:百度知道 编辑:UC知道 时间:2024/06/01 17:37:23
还有他们各自的参数是什么?

函数名称: findfirst
函数原型: int findfirst(char *fname,struct ffblk *ptr,int attrib)
函数功能: 寻找与fname相匹配的第一个文件名称
函数返回:
参数说明: ptr-保存查找到的文件信息
所属文件: <dir.h >

#include <stdio.h >
#include <dir.h >
int main()
{
struct ffblk ffblk;
int done;
printf("Directory listing of *.*");
done=findfirst("*.*",&ffblk,0);
while (!done)
{
printf("%s", ffblk.ff_name);
done=findnext(&ffblk);
}
return 0;
}

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; /*文件属性*/ ┃