Wednesday, 15 July 2015

C++ - save txt as html using fstream -



C++ - save txt as html using fstream -

i creating simple programme in user able edit .txt file created programme , programme should save file .html document. not want utilize libraries whatsoever.

creating .txt file:

std::ofstream file("save.txt");

how should without using unneccesary extensions?

if have new plenty compiler:

std::ofstream("save.html") << std::ifstream("save.txt");

if have older compiler:

std::ifstream in("save.txt"); std::ofstream out("save.html"); out << in;

however, makes total , finish exact re-create of file different name. recommend using os specific function phone call rename file, or better, have user come in info html file directly.

c++ html fstream

No comments:

Post a Comment