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>
<sstream>
類模板
basic_istringstream
basic_ostringstream
basic_stringbuf
basic_stringstream
類
istringstream
ostringstream
stringbuf
stringstream
wistringstream
wostringstream
wstringbuf
wstringstream
stringbuf
stringbuf::stringbuf
公有成員
stringbuf::str
虛擬成員
stringbuf::overflow
stringbuf::pbackfail
stringbuf::seekoff
stringbuf::seekpos
stringbuf::setbuf
stringbuf::underflow
參考
<sstream>
stringbuf
overflow
受保護的虛成員函式
<sstream>
std::
stringbuf
::overflow
int overflow (int c = EOF);
放置字元
將字元
c
寫入“put”指標(
pptr
)的當前位置,並將該指標向前移動一個位置。
如果沒有可用位置,並且
stringbuf
物件是用
ios_base::out
構建的,則該函式首先嚐試使更多寫入位置可用,必要時重新分配內部緩衝區:這可能會修改輸入和輸出控制序列的指標(最多為
eback
、
gptr
、
egptr
、
pbase
、
pptr
、
epptr
中的所有指標)。
該函式還可能在每次呼叫此函式時重新分配緩衝區以使其更大,即使仍有可用寫入位置(儘管不強制要求這樣做)。
如果
c
是
EOF
,則不寫入任何字元,也不移動“put”指標(
pptr
),但仍可能發生上述重新分配(儘管不強制要求這樣做)。
當“put”指標(
pptr
)沒有可用寫入位置時,此虛擬函式會被
sputc
等公共成員函式呼叫以寫入字元。
引數
c
要寫入的字元。
如果這是
EOF
,則不寫入任何字元,也不移動“put”指標(
pptr
),但可能適用其他效果。
返回值
如果成功,則返回值不為
EOF
:如果字元
c
已成功寫入,則返回
c
。
否則,返回
EOF
以表示失敗。
資料競爭
修改
stringbuf
物件。
併發訪問同一物件可能導致資料競爭。
異常安全
基本保證:
如果丟擲異常,物件處於有效狀態。
另見
streambuf::sputc
在當前放置位置儲存字元並增加放置指標
(公有成員函式)
stringbuf::underflow
獲取字元(受保護的虛成員函式)