std::basic_ios<CharT,Traits>:: setstate
From cppreference.net
|
void
setstate
(
iostate state
)
;
|
||
스트림 오류 플래그 state 를 현재 설정된 플래그에 추가로 설정합니다. 기본적으로 clear ( rdstate ( ) | state ) 를 호출합니다. 예외를 발생시킬 수 있습니다.
목차 |
매개변수
| state | - |
설정할 스트림 오류 상태 플래그. 다음 상수들의 조합일 수 있습니다:
|
반환값
(없음)
예제
이 코드 실행
#include <iostream> #include <sstream> int main() { std::ostringstream stream; if (!stream.fail()) std::cout << "stream is not fail\n"; stream.setstate(std::ios_base::failbit); if (stream.fail()) std::cout << "now stream is fail\n"; if (!stream.good()) std::cout << "and stream is not good\n"; }
출력:
stream is not fail now stream is fail and stream is not good
참고 항목
|
상태 플래그를 반환합니다
(public member function) |
|
|
상태 플래그를 수정합니다
(public member function) |