本文整理汇总了C++中CFileFind::FindNextFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileFind::FindNextFile方法的具体用法?C++ CFileFind::FindNextFile怎么用?C++ CFileFind::FindNextFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileFind
的用法示例。
在下文中一共展示了CFileFind::FindNextFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileCheckMusicInGroup
CString FileCheckMusicInGroup( CString csDir )
{
CString csName;
CString csTemp;
CString csMark;
CFileFind cFile;
CFileFind *pcFile = &cFile;
csTemp.Format( _T("%s\\*"), csDir );
BOOL b = pcFile->FindFile( csTemp );
csMark.Format( _T("") );
b = pcFile->FindNextFile();
b = pcFile->FindNextFile();
while( b != NULL )
{
b = pcFile->FindNextFile();
if( pcFile->IsDirectory() )
{
csTemp = pcFile->GetFilePath();
csMark = FileCheckMusicInGroup( csTemp );
}
else
{
csName = pcFile->GetFileName();
csTemp = FileArrangeGetSuffix( csName );
csMark = WordCheckMusicSuffix( csTemp );
}
if( csMark.Compare( _T("") ) > 0 )
return csMark;
}
return csMark;
}
示例2: FindExtensions
void InformApp::FindExtensions(void)
{
m_extensions.clear();
for (int i = 0; i < 2; i++)
{
CString path;
switch (i)
{
case 0:
path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
break;
case 1:
path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
break;
default:
ASSERT(FALSE);
break;
}
CFileFind find;
BOOL finding = find.FindFile(path);
while (finding)
{
finding = find.FindNextFile();
if (!find.IsDots() && find.IsDirectory())
{
CString author = find.GetFileName();
if (author == "Reserved")
continue;
if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
continue;
path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
CFileFind find;
BOOL finding = find.FindFile(path);
while (finding)
{
finding = find.FindNextFile();
if (!find.IsDirectory())
{
CString ext = ::PathFindExtension(find.GetFilePath());
if (ext.CompareNoCase(".i7x") == 0)
m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
else if (ext.IsEmpty() && (i == 1))
{
// Rename an old-style extension (with no file extension) to end with ".i7x"
CString newPath = find.GetFilePath();
newPath.Append(".i7x");
if (::MoveFile(find.GetFilePath(),newPath))
m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
}
}
}
find.Close();
}
}
find.Close();
}
std::sort(m_extensions.begin(),m_extensions.end());
}
示例3: FileCheckTypeInGroup
void FileCheckTypeInGroup( CString csDir, int *pMusicCount, int *pCoverCount )
{
CString csName;
CString csTemp;
int nResult;
CFileFind cFile;
CFileFind *pcFile = &cFile;
csTemp.Format( _T("%s\\*"), csDir );
BOOL b = pcFile->FindFile( csTemp );
b = pcFile->FindNextFile();
b = pcFile->FindNextFile();
while( b != NULL )
{
b = pcFile->FindNextFile();
if( pcFile->IsDirectory() )
{
csTemp = pcFile->GetFilePath();
FileCheckTypeInGroup( csTemp, pMusicCount, pCoverCount );
}
else
{
csTemp = pcFile->GetFileName();
csTemp = FileArrangeGetSuffix( csTemp );
nResult = WordCheckSuffix( csTemp );
if( nResult == 1 )
( *pMusicCount ) += 1;
else if( nResult == 4 )
( *pCoverCount ) += 1;
}
}
return ;
}
示例4: DeleteRecord
/**********************************************************************
* 函数名称: // DeleteRecord()
* 功能描述: // 删除多余的log文件,保存的个数可以通过SetLogRecordCount改变
* 输入参数: // 无
* 输出参数: // 无
* 返 回 值: // 返回True
* 其它说明: // 无
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
* 2009/07/21 V1.0
***********************************************************************/
BOOL CLogRecord::DeleteRecord()
{
CString strFile;
CFileFind finder;
BOOL bWorking;
int nfileNum = 0;
strFile.Format("%s\\*.log",m_strCurrentRecordPath);
bWorking = finder.FindFile(strFile);
while (bWorking)
{
bWorking = finder.FindNextFile();
nfileNum++;
}
finder.Close();
if(nfileNum >m_nRecordLogCount)
{
nfileNum = nfileNum-m_nRecordLogCount;
bWorking = finder.FindFile(strFile);
while (bWorking&&nfileNum)
{
bWorking = finder.FindNextFile();
nfileNum--;
DeleteFile(finder.GetFilePath());
}
}
finder.Close();
return TRUE;
}
示例5: ScanFolderToAdd
int CPartFileConvert::ScanFolderToAdd(CString folder,bool deletesource) {
int count=0;
CFileFind finder;
BOOL bWorking;
bWorking = finder.FindFile(folder+_T("\\*.part.met"));
while (bWorking) {
bWorking=finder.FindNextFile();
ConvertToeMule(finder.GetFilePath(),deletesource);
count++;
}
// Shareaza
bWorking = finder.FindFile(folder+_T("\\*.sd"));
while (bWorking) {
bWorking=finder.FindNextFile();
ConvertToeMule(finder.GetFilePath(),deletesource);
count++;
}
bWorking = finder.FindFile(folder+_T("\\*.*"));
while (bWorking) {
bWorking = finder.FindNextFile();
CString test=finder.GetFilePath();
if (finder.IsDirectory() && finder.GetFileName().Left(1)!=_T("."))
count += ScanFolderToAdd(finder.GetFilePath(),deletesource);
}
return count;
}
示例6: FindFiles
int CFileName::FindFiles (LPCTSTR pszDir,CFileNameArray &ar,LPCTSTR pszPattern/*=_T("*.*")*/,bool bRecurse/*=true*/,DWORD dwExclude/*=FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN*/)
{
ar.RemoveAll();
CFileFind finder;
BOOL bMore=finder.FindFile(CFileName(pszDir)+pszPattern);
while (bMore) {
bMore = finder.FindNextFile();
if(!finder.IsDots() && !finder.MatchesMask(dwExclude)){
CFileName strFile(finder.GetFilePath());
ar.Add(strFile);
}
}
if(bRecurse){
CFileFind finder;
BOOL bMore=finder.FindFile(CFileName(pszDir)+_T("*.*"));
while (bMore) {
bMore = finder.FindNextFile();
if(!finder.IsDots() && finder.IsDirectory()){
CFileNameArray ar2;
FindFiles(finder.GetFilePath(),ar2,pszPattern,bRecurse,dwExclude);
ar.Append(ar2);
}
}
}
return ar.GetSize();
}
示例7: GetFileNameArray
void CTaiKlineDlgHistorySelect::GetFileNameArray(CStringArray &sArry)
{
CString sPath = "data\\historysh\\";
CFileFind finder;
int n = 0;
BOOL bWorking = finder.FindFile(sPath+"*.hst");
while(bWorking)
{
bWorking = finder.FindNextFile();
CString filename = finder.GetFileTitle();
int nSize = sArry.GetSize ();
for(int j=0;j<nSize;j++)
{
if(filename <sArry[j])
{
sArry.InsertAt (j,filename);
break;
}
if(j==nSize-1)
sArry.Add (filename);
}
if(nSize == 0)
sArry.Add (filename);
n++;
}
sPath = "data\\historysz\\";
n = 0;
bWorking = finder.FindFile(sPath+"*.hst");
while(bWorking)
{
bWorking = finder.FindNextFile();
CString filename = finder.GetFileTitle();
int nSize = sArry.GetSize ();
BOOL bf;
bf=false;
for(int j=0;j<nSize;j++)
{
if(filename ==sArry[j])
{
bf=true;
break;
}
else
{
bf=false;
continue;
}
if(j==nSize-1)
sArry.Add (filename);
}
if((nSize == 0)||(!bf))
sArry.Add (filename);
n++;
}
}
示例8: MoveDirectory
// 将pc中的文件夹从一个目录拷贝到另外的一个目录
BOOL MoveDirectory(CString strSrcPath, CString strDesPath)
{
if( strSrcPath.IsEmpty() )
{
return FALSE;
}
if ( !PathIsDirectory(strDesPath) )
{
if ( !CreateDirectory(strDesPath,NULL))
return FALSE;
}
if ( strSrcPath.GetAt(strSrcPath.GetLength()-1) != '\\' )
strSrcPath += '\\';
if ( strDesPath.GetAt(strDesPath.GetLength()-1) != '\\' )
strDesPath += '\\';
BOOL bRet = FALSE; // 因为源目录不可能为空,所以该值一定会被修改
CFileFind ff;
BOOL bFound = ff.FindFile(strSrcPath+_T("*"), 0);
CString strFile;
BOOL bSpecialFile=FALSE;
while(bFound) // 递归拷贝
{
bFound = ff.FindNextFile();
bSpecialFile=FALSE;
if( ff.IsDots() )
continue;
CString strSubSrcPath = ff.GetFilePath();
CString strSubDespath = strSubSrcPath;
strSubDespath.Replace(strSrcPath, strDesPath);
if( ff.IsDirectory() )
bRet = MoveDirectory(strSubSrcPath, strSubDespath); // 递归拷贝文件夹
else
{
strFile=PathFindFileName(strSubSrcPath);
strFile.MakeUpper();
for (int i=0;i<nSpecialFileCount;i++)
{
//找到特殊文件
if(_tcscmp(strFile.GetString(),sSpecialFile[i])==0)
{
bSpecialFile=TRUE;
break;
}
}
if(bSpecialFile)
bRet=MoveFileEx( strSubSrcPath,strSubDespath,MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
else
bRet = MoveFileEx(strSubSrcPath, strSubDespath,MOVEFILE_REPLACE_EXISTING); // 移动文件
}
if ( !bRet )
break;
}
ff.Close();
return bRet;
}
示例9: GetRootPoint
int KGObjectPropertyEditDlg::GetRootPoint(CString szPath)
{
int nResult = false;
int nRetCode = false;
CFileFind file;
BOOL bContinue = file.FindFile(szPath + "*");
KG_PROCESS_ERROR(szPath != "");
int temp = 0;
while (bContinue)
{
bContinue = file.FindNextFile();
if (file.IsDirectory() && !file.IsDots())
{
if (temp == 0)
{
m_treeRoot = m_treeObjectView.InsertItem(file.GetFileName());
temp = 1;
}
else
{
m_treeObjectView.InsertItem(file.GetFileName());
}
}
}
nResult = true;
Exit0:
file.Close();
return nResult;
}
示例10: RefreshLanguageFolder
//Actions
void LanguageManager::RefreshLanguageFolder()
{
ClearLanguages();
TCHAR searchPath[MAX_PATH];
_sntprintf(searchPath, MAX_PATH, _T("%s*.lng"), GetLanguageFolder());
CFileFind ff;
BOOL bCont = ff.FindFile(searchPath);
while (bCont)
{
bCont = ff.FindNextFile();
FullLanguageInfo lInfo;
lInfo.langPath = ff.GetFilePath();
lInfo.bIsValid = TRUE;
m_languages.push_back(lInfo);
//MappedLanguage lng;
//if (LanguageSerialization::ImportLngFile(ff.GetFilePath(), lng, TRUE))
//{
// pLS->info = lng.GetLanguageInfo();
// m_languages.push_back(pLS);
//}
//else
// TRACE(_T("@1LanguageManager::ScanLanguagesFolder. Invalide lng File '%s'\r\n"), ff.GetFilePath());
}
return;
}
示例11: DeleteImageFolder
void CDlgArmLogICImage::DeleteImageFolder(CString csFolderName)
{
CString csFilePath = _T("");
csFilePath = m.FilePath.ArmLogICImagePath + csFolderName + "\\";
CFileFind find;
BOOL bResult = find.FindFile( csFilePath + _ArmLogICImage2 );
CString file = _T("");
m_Files.RemoveAll();
long lFileSize = 0.0;
while(bResult)
{
bResult = find.FindNextFile();
file = find.GetFileName(); // Get File Name..
if(file.Find( _ArmLogICImage, 0)>-1)
{
// show file data
CString csDeleteFilePath = _T("");
csDeleteFilePath = m.FilePath.ArmLogICImagePath + csFolderName + "\\" + file;
::DeleteFile( csDeleteFilePath );
}
}
//
CString csDeleteDbFilePath = _T("");
csDeleteDbFilePath = m.FilePath.ArmLogICImagePath + csFolderName + "\\" + _ArmLogICDb;
::DeleteFile( csDeleteDbFilePath );
//
RemoveDirectory( m.FilePath.ArmLogICImagePath + csFolderName );
}
示例12: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
cvNamedWindow("Show",1);
CString route = "D:\\Code\\r200Test\\output\\P00_00\\*.jpg";
BOOL videoFindFlag;
CFileFind videoFileFind;
videoFindFlag = TRUE;
videoFindFlag = videoFileFind.FindFile(route);
while(videoFindFlag)
{
// Find the sign video
videoFindFlag = videoFileFind.FindNextFile();
CString videoFileName = videoFileFind.GetFilePath();
IplImage* img= cvLoadImage(videoFileName,1);
IplImage* g_pGrayImage = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
cvCvtColor(img, g_pGrayImage, CV_BGR2GRAY);
IplImage* g_pBinaryImage = cvCreateImage(cvGetSize(g_pGrayImage), IPL_DEPTH_8U, 1);
cvThreshold(g_pGrayImage, g_pBinaryImage, 120, 255, CV_THRESH_BINARY);
// 检索轮廓并返回检测到的轮廓的个数
CvMemStorage *pcvMStorage = cvCreateMemStorage();
CvSeq *pcvSeq = NULL;
cvFindContours(g_pBinaryImage, pcvMStorage, &pcvSeq,
sizeof(CvContour), CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
CvSeq *maxSeq = GetAreaMaxContour(pcvSeq);
// 画轮廓图
IplImage *pOutlineImage = cvCreateImage(cvGetSize(g_pBinaryImage), IPL_DEPTH_8U, 3);
int nLevels = 1;
// 填充成白色
cvRectangle(pOutlineImage, cvPoint(0, 0), cvPoint(pOutlineImage->width, pOutlineImage->height),
CV_RGB(255, 255, 255), CV_FILLED);
cvDrawContours(pOutlineImage, maxSeq, CV_RGB(0,0,0), CV_RGB(0,255,0), nLevels, CV_FILLED);
// 腐蚀和膨胀。或者采用平滑maxSeq中的各个点的方法
IplConvKernel *element = 0;
int element_shape=MORPH_ELLIPSE;//长方形形状的元素
int an = 5;
element = cvCreateStructuringElementEx(an*2+1, an*2+1,an,an,element_shape,0);
cvDilate(pOutlineImage,pOutlineImage,element,1);
//cvErode(pOutlineImage,pOutlineImage,element,1);
cvShowImage("Show",pOutlineImage);
cvWaitKey(10);
// Release
cvReleaseMemStorage(&pcvMStorage);
cvReleaseImage(&pOutlineImage);
cvReleaseImage(&img);
cvReleaseImage(&g_pGrayImage);
cvReleaseImage(&g_pBinaryImage);
}
cvDestroyWindow("Test");
getchar();
return 0;
}
示例13: InitLanguages
static void InitLanguages(const CString& rstrLangDir, bool bReInit = false)
{
static BOOL _bInitialized = FALSE;
if (_bInitialized && !bReInit)
return;
_bInitialized = TRUE;
CFileFind ff;
bool bEnd = !ff.FindFile(rstrLangDir + _T("*.dll"), 0);
while (!bEnd)
{
bEnd = !ff.FindNextFile();
if (ff.IsDirectory())
continue;
TCHAR szLandDLLFileName[MAX_PATH];
_tsplitpath(ff.GetFileName(), NULL, NULL, szLandDLLFileName, NULL);
SLanguage* pLangs = _aLanguages;
if (pLangs){
while (pLangs->lid){
if (_tcsicmp(pLangs->pszISOLocale, szLandDLLFileName) == 0){
pLangs->bSupported = TRUE;
break;
}
pLangs++;
}
}
}
ff.Close();
}
示例14: GetChildFolders
void CMyExplorerDoc::GetChildFolders(CStringArray *strFolderList, CString strParentFolder)
{
// MFC에서 지원되는 파일 검색 객체
CFileFind ff;
if (strParentFolder.Right(1) != '\\')
{
strParentFolder += '\\';
}
strParentFolder += "*.*";
// 주어진 경로의 파일을 찾음
if (ff.FindFile(strParentFolder) == TRUE)
{
BOOL bFlag = TRUE;
while(bFlag == TRUE)
{
// 파일이 존재할 경우 다음 파일을 찾을수
// 있도록 해준다.
bFlag = ff.FindNextFile();
// 파일이 디렉토리이면 0이 아닌 수를 리턴
// 파일이 '.' 또는 '..'이면 0이 아닌 수를 리턴
if (ff.IsDirectory() && !ff.IsDots())
strFolderList->Add(ff.GetFileName());
}
}
ff.Close();
}
示例15: directoryDelete
BOOL directoryDelete( LPCTSTR lpstrDir)
{
CFileFind cFinder;
CString csPath;
BOOL bWorking;
try
{
csPath.Format( _T( "%s\\*.*"), lpstrDir);
bWorking = cFinder.FindFile( csPath);
while (bWorking)
{
bWorking = cFinder.FindNextFile();
if (cFinder.IsDots())
continue;
if (cFinder.IsDirectory())
directoryDelete( cFinder.GetFilePath());
else
DeleteFile( cFinder.GetFilePath());
}
cFinder.Close();
return RemoveDirectory( lpstrDir);
}
catch (CException *pEx)
{
cFinder.Close();
pEx->Delete();
return FALSE;
}
}