This documentation is archived and is not being maintained.


Specifies starting point for offset operations.

typedef T4 seekdir;
static const seekdir beg, cur, end;


The type is an enumerated type T4 that describes an object that can store the seek mode used as an argument to the member functions of several iostream classes. The distinct flag values are:

  • beg, to seek (alter the current read or write position) relative to the beginning of a sequence (array, stream, or file).
  • cur, to seek relative to the current position within a sequence.
  • end, to seek relative to the end of a sequence.


// ios_base_seekdir.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

int main ( ) 
   using namespace std;
   fstream file; "rm.txt", ios_base::out | ios_base::trunc );

   file << "testing";
   file.seekg( 0, ios_base::beg );
   file << "a";
   file.seekg( 0, ios_base::end );
   file << "a";

Contents of File


See Also

ios_base Class | ios_base Members