C++文件遍历(小工具)
标签:htm tor first printf use print str ack ptr
用于生成html超链接方便下载
#include
#include
#include
#include
#include
using namespace std;
size_t FinFiles(vector&files)
{
files.clear();
char buffer[MAX_PATH] = {};
GetCurrentDirectoryA(MAX_PATH, buffer);
string path = buffer;
path += "\\*.*";
_finddata_t fileinfo;
long handle = _findfirst(path.c_str(), &fileinfo);
if (handle == -1)
{
return -1;
}
do
{
printf("%s\n", fileinfo.name);
files.push_back(fileinfo.name);
} while (!_findnext(handle, &fileinfo));
_findclose(handle);
handle = 0;
return files.size();
}
bool MakeHtml(vector&files)
{
FILE* pfile;
fopen_s(&pfile, "test", "wb+");
if (pfile == nullptr)
{
return false;
}
string s1 = "";
string s3 = "
\n";
for each(string curfile in files)
{
string s = s1 + curfile + s2 + curfile + s3;
cout files;
FinFiles(files);
MakeHtml(files);
system("pause");
return 0;
}
C++文件遍历(小工具)
标签:htm tor first printf use print str ack ptr
原文地址:https://www.cnblogs.com/biu-we/p/13261898.html
评论