well, nope, I would not flinch :-D but what I meant is different, somewhat.
I mean, sure I can pass objects, variabels and stuff, but when I open a file in one function, at the end the file is closed, isn't it? Thats what I meant, my stream-objects have function-scope and will be "vanished".
Ok, so within my one function "appendto_file()" I would use fstream instead of ifstream.
so, something like this??
Code:
std::fstream appendfile ( filename.c_str() );
string readtext; // to print out the file-content
getline( appendfile, readtext );
std::cout << readtext;
std::string appendtext; // where the userinput goes into
std::getline ( std::cin, appendtext );
appendfile<<appendtext.c_str();
appendfile.closoe()