0
C++ file handling
can we read and write .cpp files with file handling?
4 ответов
+ 3
Yes, you can alter .cpp files using fstream.
+ 2
No, as fstream only supports manipulation of files. It has no idea what the files are for and how are they to be used.
To compile a cpp file, you can use the system() function in <cstdlib>:
// C++ Version. Assuming C++11
string cpp_ver = "-std=c++11";
// Additional libraries which are required.
string libs = "";
// The file name, to be compiled.
// Provide Complete Path.
string file = "a.cpp";
system(("g++ "+cpp_ver+" \""+libs+"\" \""+file+"\ -o \""+file.substr(0,file.size()-5)+
"\"").c_str());
0
can we compile it also using file handling?
0
thanx