I'm trying to write into a file using fstream, but my code is not working. Can you help me what am I doing wrong?
void mem_test() { fstream filepointer; string buffer; if ( filepointer.is_open() ) { filepointer.open("test.t", ios::in | ios::out | ios::binary); getline(filepointer, buffer); getline(filepointer, buffer); filepointer << "TEST!" << endl; } filepointer.close(); } My file test.t (Perimssion to read and write the file in linux):
Example Line 1 Example Line 2 Example Line 3 Example Line 4 Thanks!