📄 处理文件夹.txt
字号:
vector<string> GetAllNewMail(string mailDir)
{
vector<string> MailVec;
int num=0;
string tempfile;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
BOOL result,fFinished = FALSE;
string strPath = mailDir+"\\";
string strFileEx;
strFileEx = strPath+"*.txt";
hFind = FindFirstFile( strFileEx.c_str(),&FindFileData );
if( hFind == INVALID_HANDLE_VALUE )
cerr<<"Error: there is no .txt files in this directory!"<<endl;
else
{
num++;
tempfile = FindFileData.cFileName;
MailVec.push_back( tempfile );
}
while( !fFinished )
{
result = FindNextFile( hFind, &FindFileData );
if( !result )
{
if (GetLastError() == ERROR_NO_MORE_FILES)
{
cout<<"There are total "<<num<<" new mail to classify!"<<endl;
fFinished = TRUE;
}
else
{
cerr<<"Couldn't find next file."<<endl;
}
}
else
{
num++;
tempfile = FindFileData.cFileName;
MailVec.push_back( tempfile );
}
}
return MailVec;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -