cplusplus
.com
教程
參考
文章
論壇
C++
教程
參考
文章
論壇
參考
C 庫
<cassert> (assert.h)
<cctype> (ctype.h)
<cerrno> (errno.h)
C++11
<cfenv> (fenv.h)
<cfloat> (float.h)
C++11
<cinttypes> (inttypes.h)
<ciso646> (iso646.h)
<climits> (limits.h)
<clocale> (locale.h)
<cmath> (math.h)
<csetjmp> (setjmp.h)
<csignal> (signal.h)
<cstdarg> (stdarg.h)
C++11
<cstdbool> (stdbool.h)
<cstddef> (stddef.h)
C++11
<cstdint> (stdint.h)
<cstdio> (stdio.h)
<cstdlib> (stdlib.h)
<cstring> (string.h)
C++11
<ctgmath> (tgmath.h)
<ctime> (time.h)
C++11
<cuchar> (uchar.h)
<cwchar> (wchar.h)
<cwctype> (wctype.h)
容器
C++11
<array>
<deque>
C++11
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
C++11
<unordered_map>
C++11
<unordered_set>
<vector>
輸入/輸出
<fstream>
<iomanip>
<ios>
<iosfwd>
<iostream>
<istream>
<ostream>
<sstream>
<streambuf>
多執行緒
C++11
<atomic>
C++11
<condition_variable>
C++11
<future>
C++11
<mutex>
C++11
<thread>
其他
<algorithm>
<bitset>
C++11
<chrono>
C++11
<codecvt>
<complex>
<exception>
<functional>
C++11
<initializer_list>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
C++11
<random>
C++11
<ratio>
C++11
<regex>
<stdexcept>
<string>
C++11
<system_error>
C++11
<tuple>
C++11
<type_traits>
C++11
<typeindex>
<typeinfo>
<utility>
<valarray>
<fstream>
類模板
basic_filebuf
basic_fstream
basic_ifstream
basic_ofstream
類
filebuf
fstream
ifstream
、ofstream
wfilebuf
wfstream
wifstream
、wofstream
filebuf
filebuf::~filebuf
filebuf::filebuf
公有成員
filebuf::close
filebuf::is_open
filebuf::open
C++11
filebuf::operator=
C++11
filebuf::swap
受保護的虛成員
filebuf::imbue
filebuf::overflow
filebuf::pbackfail
filebuf::seekoff
filebuf::seekpos
filebuf::setbuf
filebuf::showmanyc
filebuf::sync
filebuf::uflow
filebuf::underflow
非成員過載
C++11
swap (filebuf)
參考
<fstream>
filebuf
類
<fstream>
std::
filebuf
typedef basic_filebuf<char> filebuf;
檔案流緩衝區
streambuf
filebuf
用於從檔案讀取和寫入檔案的流緩衝區。
這些物件在構造時未關聯,它們透過呼叫成員函式
open
與檔案關聯。一旦
開啟
,對該物件執行的所有輸入/輸出操作都會反映在關聯檔案中。
此類物件可能在內部維護一個
中間輸入緩衝區
和/或一個
中間輸出緩衝區
,用於 i/o 操作讀取或寫入單個字元。這些緩衝區在填滿時、在顯式請求時(
sync
)或在物件
關閉
時與檔案內容同步。
透過使用兩個引數均設定為零的成員函式
pubsetbuf
(參見成員函式
setbuf
)可以顯式地將此類物件設定為無緩衝:無緩衝的
檔案流緩衝區
直接對檔案執行 i/o 操作,而不使用中間緩衝區。
透過在類中重寫的
streambuf
虛成員提供的介面,將與字元序列(即檔案)的訪問許可權授予流。
這是
basic_filebuf
的一個例項化,具有以下模板引數:
模板引數
定義
註釋
charT
char
別名為成員
char_type
特性 (traits)
char_traits
<char>
別名為成員
traits_type
成員型別
成員型別
定義
char_type
char
traits_type
char_traits
<char>
int_type
int
pos_type
streampos
off_type
streamoff
公開成員函式
(建構函式)
構造物件
(公開成員函式)
(解構函式)
析構物件
(公共成員函式)
operator=
移動賦值
(公開成員函式)
swap
交換檔案緩衝區
(公開成員函式)
檔案關聯
open
開啟檔案
(公開成員函式)
is_open
檢查檔案是否已開啟
(公有成員函式)
close
關閉檔案
(公開成員函式)
從
streambuf
繼承的公共成員函式
區域設定
:
pubimbue
注入 locale
(公開成員函式)
getloc
獲取當前 locale
(公開成員函式)
緩衝區管理和定位
:
pubsetbuf
設定緩衝區陣列
(公有成員函式)
pubseekoff
將內部位置指標設定為相對位置
(公有成員函式)
pubseekpos
將內部位置指標設定為絕對位置
(公有成員函式)
pubsync
同步流緩衝區
(公有成員函式)
輸入函式 (get)
:
in_avail
獲取可供讀取的字元數
(公有成員函式)
snextc
前進到下一個位置並獲取字元
(公有成員函式)
sbumpc
獲取當前字元並前進到下一個位置
(公有成員函式)
sgetc
獲取當前字元
(公有成員函式)
sgetn
獲取字元序列
(公有成員函式)
sputbackc
放回字元
(公共成員函式)
sungetc
後退當前位置
(公有成員函式)
輸出函式 (put)
:
sputc
在當前放置位置儲存字元並增加放置指標
(公有成員函式)
sputn
放置字元序列
(公有成員函式)
受保護的虛擬函式重寫
showmanyc
獲取可用字元數
(保護虛成員函式)
underflow
在下溢時獲取字元
(保護虛成員函式)
uflow
在上溢時獲取字元並前進位置
(受保護的虛成員函式)
pbackfail
將字元放回備份下溢
(受保護的虛成員函式)
overflow
在上溢時放置字元
(保護虛成員函式)
setbuf
設定緩衝區
(保護虛成員函式)
seekoff
將內部位置設定為相對位置
(受保護的虛成員函式)
seekpos
將位置指標設定為絕對位置
(受保護的虛成員函式)
sync
同步緩衝區
(受保護的虛成員函式)
imbue
注入區域設定
(保護虛成員函式)
此類還繼承了其他非虛或未重寫的受保護成員。有關更多詳細資訊,請參見基類
streambuf
。
非成員函式過載
swap
交換檔案緩衝區
(函式)