• 枚举当前路径下的txt文件

    CString CConfInfo::GetTxtFile()

    {

    WIN32_FIND_DATA FileData;

    static HANDLE hSearch = 0;

    BOOL fFinished = FALSE;

    CString strFileName;

    BOOL bReturn;

    //枚举当前目录下的所有文件

    if (hSearch==0)

    {

    hSearch = FindFirstFile( "*.txt", &FileData);

    strFileName = FileData.cFileName;

    strFileName.MakeLower();

    return strFileName;

    }

    if (hSearch == INVALID_HANDLE_VALUE)

    {

    //AfxMessageBox( "枚举失败! ");

    strFileName = "";

    return strFileName;

    }

    else

    {

    bReturn = FindNextFile(hSearch, &FileData) ;

    if (bReturn==0)

    {

    FindClose(hSearch);

    return "";

    }

    strFileName = FileData.cFileName;

    strFileName.MakeLower();

    return strFileName;

    }

    }
    2010/10/12 17:09:15
举报不良信息

 

 大  小