I am witing a program to change the the text in a file from "This is an apple" to This is a sample". I need to open the file in append mode too for adding text afterward.
The code for program is:-
using namespace std;
int main (int argc, char *argv)
cout << "Error opening file, errno: " << errno ;
cout<<"\n pos is " << pos;
cout<<"\n pos is " << outfile.tellp();
outfile.write (" sam",4);
The problem is instead of changing the text it adds the word sam in the file. Please help.