#include <io.h>
bool transfer(std::string &path, int exeNum = 0)
{
_finddata_t fileInfo;
long handle = _findfirst(path.c_str(), &fileInfo);
if (handle == -1L)
{
return false;
}
do
{
if ((strcmp(fileInfo.name, ".") != 0) && (strcmp(fileInfo.name, "..") != 0))
{
exeNum++;
}
std::cout << fileInfo.name << std::endl;
} while (_findnext(handle, &fileInfo) == 0);
std::cout << " number: " << exeNum << std::endl;
return true;
}
int main(int argc, char* argv[])
{
std::string path = "C:\\home\\MFC";
path = path + "\\*.*";
transfer(path);
return 0;
}