C++如何改名字

[复制链接]
558|1
手机看帖
扫描二维码
随时随地手机跟帖
limee|  楼主 | 2019-6-18 19:56 | 显示全部楼层 |阅读模式
int main(int argc, char * argv[])
{
    string PATH = ".";
    vector<string> files;
    ifstream inF;                                    // 增加
    ofstream ouF;                                    // 增加
    ouF.open("nas", std::ofstream::binary);          // 增加
    readFileList(PATH, files, "ts");
    cout << "Please wait!" << endl;                  // 增加
    for (int i = 0; i < files.size(); ++i)
    {
        inF.open(files[i], std::ofstream::binary);   // 增加
        ouF << inF.rdbuf();                          // 增加
        inF.close();                                 // 增加   
        // cout << files[i] << endl;                 // 这里可以删除
    }
    ouF.close();                                     // 增加
    return 0;
}

程序退出的时候把自己建立的nas改名为nas.ts,这个如何实现啊?

使用特权

评论回复

相关帖子

dirtwillfly| | 2019-6-18 22:19 | 显示全部楼层
不熟悉ofstream,c语言可以用rename()

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

301

主题

475

帖子

0

粉丝