C++: Write to an existing file? -
this question has answer here:
- how append text text file in c++? 3 answers
in c++, need write existing file , keep previous content there.
this have done:
std::ofstream logging; logging.open(filename); logging << "hello\n"; logging.close();
but previous text overwritten (gone). did wrong?
thanks in advance.
logging.open(filename, std::ios_base::app);
Comments
Post a Comment