Namespaces
Variants

std:: basic_filebuf

From cppreference.net
< cpp ‎ | io
헤더 파일에 정의됨 <fstream>
template <

class CharT,
class Traits = std:: char_traits < CharT >

> class basic_filebuf : public std:: basic_streambuf < CharT, Traits >

std::basic_filebuf 는 연결된 문자 시퀀스가 파일인 std::basic_streambuf 입니다. 입력 시퀀스와 출력 시퀀스 모두 동일한 파일과 연결되며, 두 작업에 대해 공통 파일 위치가 유지됩니다. std::basic_filebuf 를 사용한 시퀀스 읽기 및 쓰기에 대한 제한은 std::FILE 과 동일합니다.

underflow() overflow() / sync() 함수들은 파일과 버퍼의 get 및 put 영역 사이에서 실제 I/O를 수행합니다. CharT char 가 아닐 경우, 대부분의 구현에서는 파일에 멀티바이트 문자를 저장하며 std::codecvt 패싯을 사용하여 와이드/멀티바이트 문자 변환을 수행합니다.

일반적인 문자 타입에 대한 여러 typedef가 제공됩니다:

헤더 파일에 정의됨 <fstream>
타입 정의
std::filebuf std :: basic_filebuf < char >
std::wfilebuf std :: basic_filebuf < wchar_t >

목차

멤버 타입

유형 정의
char_type CharT
traits_type Traits ; Traits::char_type CharT 가 아닌 경우 프로그램의 형식이 올바르지 않습니다.
int_type Traits::int_type
pos_type Traits::pos_type std:: fpos < Traits :: state_type > 여야 합니다.
off_type Traits::off_type
native_handle_type (C++26) 구현 정의 타입으로 TriviallyCopyable 이고 semiregular 입니다.

멤버 함수

공개 멤버 함수

basic_filebuf 객체를 생성함
(공개 멤버 함수)
(C++11)
basic_filebuf 객체를 할당함
(공개 멤버 함수)
(C++11)
basic_filebuf 객체를 교환함
(공개 멤버 함수)
기본 구현 정의 핸들을 반환함
(공개 멤버 함수)
[virtual]
basic_filebuf 객체를 소멸시키고 열려 있는 경우 파일을 닫음
(가상 공개 멤버 함수)
연결된 파일이 열려 있는지 확인함
(공개 멤버 함수)
파일을 열고 연결된 문자 시퀀스로 구성함
(공개 멤버 함수)
출력 영역 버퍼를 비우고 연결된 파일을 닫음
(공개 멤버 함수)

보호된 멤버 함수

[virtual]
선택적으로 파일에서 입력 가능한 문자 수를 제공함
(가상 보호된 멤버 함수)
[virtual]
연결된 파일에서 읽음
(가상 보호된 멤버 함수)
[virtual]
연결된 파일에서 읽고 입력 영역의 다음 포인터를 전진시킴
(가상 보호된 멤버 함수)
[virtual]
문자를 되돌리기 위해 입력 시퀀스를 되돌림, 연결된 파일에는 영향을 주지 않음
(가상 보호된 멤버 함수)
[virtual]
출력 영역에서 연결된 파일로 문자를 씀
(가상 보호된 멤버 함수)
[virtual]
사용자 제공 버퍼를 제공하거나 이 filebuf를 비버퍼링으로 전환함
(가상 보호된 멤버 함수)
[virtual]
상대 주소 지정을 사용하여 파일 위치를 재배치함
(가상 보호된 멤버 함수)
[virtual]
절대 주소 지정을 사용하여 파일 위치를 재배치함
(가상 보호된 멤버 함수)
[virtual]
출력 영역에서 연결된 파일로 문자를 씀
(가상 보호된 멤버 함수)
[virtual]
연결된 로케일을 변경함
(가상 보호된 멤버 함수)

비멤버 함수

std::swap 알고리즘을 특수화함
(함수 템플릿)

std:: basic_streambuf 에서 상속됨

멤버 타입

멤버 타입 정의
char_type CharT
traits_type Traits ; Traits::char_type CharT 가 아닐 경우 프로그램은 ill-formed입니다.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type

멤버 함수

[virtual]
basic_streambuf 객체를 파괴함
( std::basic_streambuf<CharT,Traits> 의 virtual public member function)
로케일
연결된 로케일을 변경하고 imbue ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
연결된 로케일의 복사본을 얻음
( std::basic_streambuf<CharT,Traits> 의 public member function)
위치 지정
setbuf ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
seekoff ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
seekpos ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
sync ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
입력 영역
입력 영역에서 즉시 사용 가능한 문자 수를 얻음
( std::basic_streambuf<CharT,Traits> 의 public member function)
입력 시퀀스를 진행시킨 후, 다시 진행하지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public member function)
(C++17에서 제거됨)
입력 시퀀스에서 한 문자를 읽고 시퀀스를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public member function)
입력 시퀀스에서 시퀀스를 진행시키지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public member function)
xsgetn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
출력 영역
출력 영역에 한 문자를 쓰고 다음 포인터를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public member function)
xsputn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public member function)
되돌리기
입력 시퀀스에 한 문자를 되돌림
( std::basic_streambuf<CharT,Traits> 의 public member function)
입력 시퀀스의 다음 포인터를 하나 뒤로 이동시킴
( std::basic_streambuf<CharT,Traits> 의 public member function)

보호된 멤버 함수

basic_streambuf 객체를 생성합니다
(protected 멤버 함수)
(C++11)
basic_streambuf 객체를 대체함
(보호된 멤버 함수)
(C++11)
두 개의 basic_streambuf 객체를 교환
(보호된 멤버 함수)
로케일
[virtual]
연결된 로캘 변경에 반응함
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
포지셔닝
[virtual]
사용자 정의 배열로 버퍼를 교체합니다(허용되는 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 상대 주소 지정을 사용하여 재위치합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected member function)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 절대 주소 지정을 사용하여 재위치합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 문자 시퀀스와 버퍼를 동기화합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
영역 가져오기
[virtual]
연결된 입력 시퀀스에서 사용 가능한 문자 수를 확인합니다(알려진 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 입력 시퀀스에서 문자를 읽어 get 영역으로 가져옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 입력 시퀀스로부터 문자를 읽어 get 영역으로 가져오고 다음 포인터를 전진시킴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스에서 여러 문자를 읽어옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
get 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(protected 멤버 함수)
입력 시퀀스의 다음 포인터를 전진시킴
(protected member function)
입력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(보호된 멤버 함수)
Put 영역
[virtual]
출력 시퀀스에 여러 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 가상 protected 멤버 함수)
[virtual]
put 영역에서 연관된 출력 시퀀스로 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
출력 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(보호된 멤버 함수)
출력 시퀀스의 다음 포인터를 진행시킵니다
(protected member function)
출력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(보호된 멤버 함수)
Putback
[virtual]
입력 시퀀스에 문자를 다시 넣으며, 입력 시퀀스를 수정할 수 있음
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)

참고 사항

기능 테스트 매크로 표준 기능
__cpp_lib_fstream_native_handle 202306L (C++26) 네이티브 핸들 지원

참고 항목

C 입출력 스트림을 제어하는 데 필요한 모든 정보를 담을 수 있는 객체 타입
(typedef)