如今用到了,自己写个修改文件扩展名的函数~~~~~~~

#include <string>
using namespace std;

/*   
 *    assistant function,
 *    return a string, get tow string&,
 *    use to change a filename's extern name;
 *    author: lonelyforest
 *    Date:    2006.03.15
 */
string change_file_ext(const string& filename, const string& new_ext)
{
    int dot_pos = 0;
    string temp = filename;
   
    for( int i = 0; i < temp.length(); ++i)
    {
        if ( temp[i] == '.' )
        {           
            dot_pos = i;
        }
    }

    temp.erase(dot_pos);
    temp += new_ext;

    return temp;
}

不是很好, 希望多多指教。

posted on 2006-03-15 21:44  h2内存数据库  阅读(152)  评论(0)    收藏  举报

导航