hi guys I'm studying and playing around with the filepointer the seekg does exactly what I expected it to do it goes to the offset where you want to position it but the seekp doesn't seem to be working in the way I expected it to,
I have a .txt file and inside it is a string saying my name is adam
when I use the tellp function I expect the pointer to be pointing the after the last character but instead it points to zero
but when when I try to add contents to a random place in the file( seekp(2) )
it just writes it to the end of the file,not sure why
so my goal is to write to a random place in the file
thanks
1 2 3 4 5 6 7 8 9
ofstream ou;
ou.open("justFor.txt",ofstream::app);
cout << "file pointer is at " << ou.tellp() << endl;
ou.seekp(2);
ou << "XX";
ou.close();