一点文件查找/删除的代码
/* Microsoft Corporation I/O functions: */
#include <io.h>

std::string str("D:");

_finddata_t f; //file struct
long label;

if( (label = _findfirst(str.c_str(), &f) ) == -1)
std::cout<<"No files! ";
else
{
std::cout<<"File List: ";
while( _findnext( label, &f) == 0)
{
std::string s( str.c_str());
s += "/";
s += f.name;
remove( s.c_str()); //remove the file
std::cout << s << std::endl;
}
}

_findclose( label );

/*================== c api ================== */
#include <stdio.h>
#include <dir.h>

struct ffblk ffblk;
int done;
printf("Directory listing of *.* ");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %s ", ffblk.ff_name);
const char * name = "ABC.txt";
rename(ffblk.ff_name, name); //rename the file.
remove(ffblk.ff_name); //remove the file
done = findnext(&ffblk);
}









































