c++ - How to change the extension of a file? -
i working on project need add message @ end of file , want change extension.
i know how add message @ end of file; code:
_ofstream myfile; _myfile.open("check.txt", std::ios_base::app); _myfile << "thanks help.\n";
how can change file's extension?
actualy, simple:
#include <iostream> #include <fstream> #include <cstdio> using namespace std; int main(int argc, char* argv[]) { ofstream fout("test.txt", ios_base::app); fout << "my cool string"; fout.close(); rename("test.txt", "test.txt1"); return 0; }
Comments
Post a Comment