다음을 통해 공유


ios_base::seekdir

Specifies starting point for offset operations.

namespace std {
   class ios_base {
   public:
      typedef implementation-defined-enumerated-type seekdir;
      static const seekdir beg;
      static const seekdir cur;
      static const seekdir end;
      ...
   };
}

설명

The type is an enumerated type 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;
   file.open( "rm.txt", ios_base::out | ios_base::trunc );

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

Contents of File

aestinga

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

ios_base 클래스

iostream 프로그래밍

iostreams 규칙