VC++6.0遍历文件夹及子目录并打印文件大小属性
/*
作者:daisy 2004级测试一班
日期“2007.6.6
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <stack>
#include <io.h>
#include <windows.h>
using namespace std;
/*
* 遍历lpszPath下所有文件及文件夹,并按顺序显示其中的内容.
* 如果扫描到文件夹,则将其存入 Dirs 队列中,并显示名称,
* 如果扫描到文件,则显示其名称;
* 当前文件夹处理完毕后就处理其下一级文件夹,下一级文件夹从队
* 列中得到.
*/
void function(LPCTSTR lpszPath,ostream& out)
{
//开始查找;
stack<TCHAR*> Dirs;
stack<int> DirDepth;
TCHAR *tmp=new TCHAR[lstrlen(lpszPath)+1];
lstrcpy(tmp,lpszPath);
if(tmp[lstrlen(tmp)-1]=="/")
tmp[lstrlen(tmp)-1]="
作者:daisy 2004级测试一班
日期“2007.6.6
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <stack>
#include <io.h>
#include <windows.h>
using namespace std;
/*
* 遍历lpszPath下所有文件及文件夹,并按顺序显示其中的内容.
* 如果扫描到文件夹,则将其存入 Dirs 队列中,并显示名称,
* 如果扫描到文件,则显示其名称;
* 当前文件夹处理完毕后就处理其下一级文件夹,下一级文件夹从队
* 列中得到.
*/
void function(LPCTSTR lpszPath,ostream& out)
{
//开始查找;
stack<TCHAR*> Dirs;
stack<int> DirDepth;
TCHAR *tmp=new TCHAR[lstrlen(lpszPath)+1];
lstrcpy(tmp,lpszPath);
if(tmp[lstrlen(tmp)-1]=="/")
tmp[lstrlen(tmp)-1]="
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
copyright © 2008-2019 亿联网络 版权所有 备案号:粤ICP备14031511号-2