... positioning the get file-position pointer are
// position to the nth byte of fileObject (assumes ios::beg) fileObject.seekg(n); // position n bytes in fileObject fileObject.seekg(n, ios::cur); // position n bytes back from end of fileObject fileObject.seekg(n, ios::end); // position at end of fileObject fileObject.seekg(0, ios::end);
The same operations can be performed using
ostream member function
seekp. Member functions
tellp are provided to return the current locations of the get and put pointers, respectively. The following statement assigns the get file-position pointer value to variable
location of type
location = fileObject.tellg();
14.4.4 Case Study: Credit Inquiry Program
Figure 14.6 enables a credit manager to display the ...
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.