ios_base::openmode

스트림과 상호 작용 하는 방법을 설명 합니다.

namespace std {
   class ios_base {
   public:
      typedef implementation-defined-bitmask-type iostate;
      static const iostate badbit;
      static const iostate eofbit;
      static const iostate failbit;
      static const iostate goodbit;
      ...
   };
}

설명

형식이 bitmask type 열기 모드 여러 iostreams 개체에 저장할 수 있는 개체를 설명 합니다.(요소) 개별 플래그 값은 다음과 같습니다.

  • 응용 프로그램각 삽입 전에 스트림의 끝에 찾기 위해.

  • 잠든, 스트림의 끝에 제어 개체를 처음 만들 때 받는 것입니다.

  • 이진, 텍스트 스트림이 아닌 이진 스트림이나 파일을 읽을 수 있습니다.

  • , 압축 풀기 스트림에서 허용 하도록 합니다.

  • 아웃, 스트림에 삽입을 허용 합니다.

  • trunc, 그 제어 하는 개체를 만들 때 기존 파일의 내용을 삭제 합니다.

예제

// ios_base_openmode.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";
}

요구 사항

헤더: <ios>

네임 스페이스: std

참고 항목

참조

ios_base Class

iostream 프로그래밍

iostreams 규칙