basic_streambuf::pubseekoff

Determines the position of the get pointer.

pos_type pubseekoff (off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out);

Remarks

The member function pubseekoff() is used to find the difference in bytes of the get pointer from a known position (such as the beginning or end of a stream). The function pubseekoff() returns a type pos_type which holds all the necessary information.

Returns a pos_type via seekoff(off, way, which)

See Also

pubseekpos()

// The ewl-test file contains originally // CodeWarrior "Software at Work" #include <iostream> #include <fstream> #include <stdlib.h> char inFile[] = "ewl-test"; int main() { using namespace std; ifstream inOut(inFile, ios::in | ios::out); if(!inOut.is_open()) {cout << "Could not open file"; exit(1);} ostream Out(inOut.rdbuf()); char str[] = "\nRegistered Trademark"; inOut.rdbuf()->pubseekoff(0, ios::end); Out << str; inOut.close(); return 0; }

Result:

The File now reads: CodeWarrior "Software at Work" Registered Trademark