独立使用Locate功能
#include"dir.h"
#include"string.h"
void search(char *path,char *file)
{
struot ffblk *ffblk=(struct ffblk *)malloc(sizeof (struct ffblk));
char *pathused=(char *)malloc(strlen(path)+14;
stpcpy(stpcpy(pathused,path),file);
if (findfirst(pathused,ffblk,o)==o)
do
printf("%s\n",ffblk->ff_name);
while(findnext(ffblk)==0;
stpcpy(stpcpy(pathused,path),"*.*"); if(findirst(pathused,ffblk,FA_DIREC)==O && strcmp(ffblk->ff_name,".")!=0)
do {
stpcpy(stpcpy(stpcpy(pathused,path),ffblk->ff_name),"\\");
search(pathused,file);
}while(findnext(ffblk)==o && strcmp(ffblk->ff_name,".")!=o);
}
main(int argo,char *argv)
{
search(strupr(argv),argv);
}
广州市第62中学 庄泗华