Ai
1 Star 0 Fork 0

lidl1/ldls Code

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fileview.cpp 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
lidl1 提交于 2021-09-12 11:39 +08:00 . 1
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <io.h>
#include <string>
#include <Windows.h>
#include <fstream>
#include <stdio.h>
#include <sys/stat.h>
#include <ctime>
using namespace std;
ofstream g_ofStream( "c:/test.txt", ios::out );
INT g_iSum = 0;
void
dfs(
IN string strPath
)
{
_finddata_t file = { 0 };
string strPath1 = strPath + "/*.*";
INT iHandle = _findfirst( strPath1.c_str(), &file );
if( -1 == iHandle )
{
cout << "error";
}
else
{
do{
if( (0 == strcmp(file.name, ".")) ||
(0 == strcmp(file.name, "..")) )
{
continue;
}
if( file.attrib & _A_SUBDIR )
{
dfs( strPath + '/' + file.name );
}
else
{
cout << file.name << " " << ctime( &file.time_create ) << " " << ctime( &file.time_write ) << " " << file.size<< endl;
g_ofStream << file.name << " " << ctime( &file.time_create ) << " " << ctime ( &file.time_write ) << " " << file.size << endl;
g_iSum++;
}
} while( !_findnext( iHandle, &file ) );
_findclose( iHandle );
}
}
int main()
{
if( Wow64EnableWow64FsRedirection( FALSE ) )
{
dfs( "C:/Windows/System32" );
cout << g_iSum << endl;
}
Wow64EnableWow64FsRedirection( TRUE );
g_ofStream.close();
system("pause");
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/lidl1/c_codes.git
git@gitee.com:lidl1/c_codes.git
lidl1
c_codes
ldls Code
master

搜索帮助