📄 文件夹递归.cpp
字号:
#include<iostream>
#include"windows.h"
#include <tchar.h>
#include"string.h"
#include"get_frequency.h"
/***************************************
* 蔡敏
***************************************/
using namespace std;
void Find_File(LPTSTR lpFilename,LPTSTR dir);
char* FindPath(char* filename);
int main()
{
LPTSTR lpFilename,dir;
bool choice;
cout<<"压缩输入1;解压输入0."<<endl;
cin>>choice;
cout<<"输入需要处理的路径名."<<endl;
lpFilename=(LPTSTR)malloc(256);
cin>>lpFilename; //////////////////////////// X
dir=(LPTSTR)malloc(256);
dir=lpFilename;
if(choice)
Find_File(lpFilename,dir);
else
HaffDecompress(lpFilename,dir);////////////////// X
system("pause");
return 0;
}
void Find_File(LPTSTR filename, LPTSTR dir)
{
cout<<filename<<endl;
LPTSTR temp1, temp2, sub_filename, lpFileName;
temp1=(LPTSTR)malloc(1);
temp1=TEXT("\\");
temp2=(LPTSTR)malloc(2);
temp2=TEXT("\\*");
sub_filename = (LPTSTR)malloc(256);
lpFileName = (LPTSTR)malloc(256);
_tcscpy(lpFileName,filename);
_tcscat(lpFileName,temp2);
WIN32_FIND_DATA lpFindData;
HANDLE hfind;
// 在 lpFileName 下寻找
hfind = FindFirstFile(lpFileName,&lpFindData);
while(FindNextFile(hfind,&lpFindData)!=0) {
if( strcmp(lpFindData.cFileName, ".") != 0 /** X */
&& strcmp(lpFindData.cFileName, "..") != 0) /** X */
{
_tcscpy(sub_filename, filename);
_tcscat(sub_filename, temp1);
_tcscat(sub_filename,lpFindData.cFileName);
if(lpFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) // 是目录
Find_File(sub_filename,dir);
else
get_frequency(sub_filename, dir);///////////// X
}
}
FindClose(hfind);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -