#include<dir.h>
void main()
{
struct ffblk ffblk
int success=0 //假设没有文件
int done
done = findfirst("c:\\test\\*.*",&ffblk,0) //假设文件夹名称c:\\test\\
if(done==0)
success=1//表示有文件
}
举例来说:FILE*fp=fopen("dict.txt","r")charbuf[1024]if(fp!=(FILE*)NULL){while(fgets(buf,sizeof(buf),fp))//从文件中读入一行字符串,保存在buf中,直到读完所有字符串{//处理读入的字符串buf}fclose(fp)}欢迎分享,转载请注明来源:内存溢出
评论列表(0条)