求CFileFind类的FindFile(LPCSTR str,DWORD )的用法
第一个参数他的匹配原则是什么样的呢?
能给个例子看吗

解决方案 »

  1.   

    下面代码删除一个文件夹里的全部文件 CFileFind cFindfile;
    CString strDir = "d:\\123\\*.*";
    BOOL bfind = cFindfile.FindFile(strDir);
    while( bfind )
    {
    bfind = cFindfile.FindNextFile();
    if( cFindfile.IsDots() )
    continue;
    DeleteFile(cFindfile.GetFilePath());
    }
      

  2.   

    以下代码找出指定目录下后缀为avi的文件名 CString path="d:\\temp\\*.*";
    CString strFileName, strSuffix, strFilePath;
    int nIndex;
    CString           strAVI;
    BOOL bIsFinded =(BOOL)tempFind.FindFile( path );
    while( bIsFinded )
    {
    bIsFinded = (BOOL)tempFind.FindNextFile();
    if( !tempFind.IsDots() ) 
    {
    strFileName = tempFind.GetFileName();
    nIndex = strFileName.ReverseFind('.');     
    strSuffix = strFileName.Mid(nIndex+1);
    strSuffix.MakeUpper();
    if ( strSuffix=="AVI" ) 
    {
    strAVI =  strFileName;    
    }
    }
    }
    tempFind.Close();
      

  3.   

    漏了一个定义
    CFileFind   tempFind;
      

  4.   

    CStringArray strArray;//定义你要的。
    CString strPath = _T("");
    char path[150];
    getcurrentDirectory(path,sizeof(path));
    strPath = path;
    strPath +="\\*.ini"; CFileFind ff; 
    BOOL res = ff.FindFile(strPath);
    while(res)
    {
    res = ff.FindNextFile();
      if(!ff.IsDirectory() && !ff.IsDots())
    {
    //显示当前访问的文件  
    CString strTitle =_T("");  
    strTitle = ff.GetFileName();//文件名称;
    strArray.Add(strTitle);
    }
    }else continue;
    }
    ff.Close();//关闭 int count = strArray.GetSize();
    if(count<=0)
    {
    MessageBox("");
    return 0;
    }