Heres a function thats intended to append a string to a text file:
I want it to seek the end of the file then write from there on, which I thought I was doing with seekp(). The problem is it overwrites the contents of the file. What am I doing wrong here?Code:bool FString::Append(const char* filename) { ofstream out; out.open(filename); if(!out.is_open())return false; out.seekp(0, ios::end); out.write(str_ptr, (int)strlen(str_ptr)); return true; }
Cheers.