i know that its so easy. but i dont know how to do it. ive tried ifstream and ofstream to add a line in a text file. and im sure someone in the past may have already posted this kind of problem. can anyone give me a link to that thread? thanks.

std::stringstream ss;
ss << "A line of text."
std::ofstream file("lines.txt", std::ios::out | std::ios::app);
if(file.is_open()) file << ss.str() << '\n';

Edit: Couple notes
You may want to read about ofstream flags, they are non-trivial.
Closing the file is important.
You don't need to use a stringstream like I did.
You should definitely check to make sure you opened the file. (shown above)