返回信息流/* findnext example */
#include <stdio.h>
#include <dir.h>
//using namespace std;
//两个函数需要定义一个结构体来存储函数返回的数据。结构体如下:
struct ffblk
{
char ff_reserved[21]; /*DOS保留字*/
char ff_attrib; /*文件属性*/
int ff_ftime; /*文件时间*/
int ff_fdate; /*文件日期*/
long ff_fsize; /*文件长度*/
char ff_name[13]; /*文件名*/
}
//将结构体中的ff_name[13]显示出来即可。
int main(void)
{
struct ffblk ffblk;
int done;
printf("Directory listing of *.*\n");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %s\n", ffblk.ff_name);
done = findnext(&ffblk);
}
return 0;
}
请问为什么在vc2010下会无法加载<dir.h>,该怎么解决??
这是一条镜像帖。来源:北邮人论坛 / cpp / #78092同步于 2014/4/3
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
[问题]新手求助
LiangJL
2014/4/3镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复
记忆里vs下没有这个文件,看看io.h里有没有你用的这几个函数。另外不考虑可移植性性的话,win下遍历目录ms有提供api。
【 在 LiangJL 的大作中提到: 】
: /* findnext example */
: #include <stdio.h>
: #include <dir.h>
: ...................