【B2B研发商城】 【加入收藏】 【设为首页】 【进入论坛】 【站点地图】

你的位置:中国研发网 >> 技术文章 >> 软件设计 >> 编程技巧 >> 详细内容 在线投稿

C++ 搜索文件路径

热度139票  浏览56次 【共0条评论】【我要评论 时间:2010年6月01日 13:28
    string directory = getenv("DH_ROOT");
list<string> tempXmlList;


#ifdef _DEBUG
#endif

    directory.append("\\demo\\config\\");
    string configxmlPath = directory;
    configxmlPath.append("*.xml");

    WIN32_FIND_DATA find_data;
    HANDLE hFileSearch = FindFirstFile(configxmlPath.c_str(), &find_data);

    if (INVALID_HANDLE_VALUE == hFileSearch)
    {
        tempXmlList.clear();
    } 
    else 
    {
        // List all the files in the directory with some info about them.
        do
        {
            if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
            {
                
            }
            else
            {                
                configxmlPath = directory;
                configxmlPath.append(find_data.cFileName);
                tempXmlList.push_back(configxmlPath);
            }
        }
        while (FindNextFile(hFileSearch, &find_data) != 0);        

        FindClose(hFileSearch);
    }
本站所有文章欢迎任何形式的转载,但请注明作者及出处,尊重他人劳动成果!
文章转载自:中国研发网 [http://www.yanfaw.com]
本文标题:C++ 搜索文件路径
顶:6 踩:6
对本文中的事件或人物打分:
当前平均分:-0.42 (43次打分)
对本篇资讯内容的质量打分:
当前平均分:0.48 (48次打分)
【已经有36人表态】
5票
感动
4票
路过
4票
高兴
5票
难过
3票
搞笑
4票
愤怒
4票
无聊
7票
同情
上一篇 下一篇
发表评论

网友评论仅供网友表达个人看法,并不表明本网同意其观点或证实其描述。

查看全部回复【已有0位网友发表了看法】