cplusplus.com
- TUTORIALS
- REFERENCE
- ARTICLES
- FORUM
C++
- Tutorials
- Reference
- Articles
- Forum
Reference
C library:
- <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)
Containers:
- C++11 <array>
- <deque>
- C++11 <forward_list>
- <list>
- <map>
- <queue>
- <set>
- <stack>
- C++11 <unordered_map>
- C++11 <unordered_set>
- <vector>
Input/Output:
- <fstream>
- <iomanip>
- <ios>
- <iosfwd>
- <iostream>
- <istream>
- <ostream>
- <sstream>
- <streambuf>
Multi-threading:
- C++11 <atomic>
- C++11 <condition_variable>
- C++11 <future>
- C++11 <mutex>
- C++11 <thread>
Other:
- <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>
class templates
- basic_istringstream
- basic_ostringstream
- basic_stringbuf
- basic_stringstream
classes
- istringstream
- ostringstream
- stringbuf
- stringstream
- wistringstream
- wostringstream
- wstringbuf
- wstringstream
stringstream
- stringstream::stringstream
public member functions
- C++11 stringstream::operator=
- stringstream::rdbuf
- stringstream::str
- C++11 stringstream::swap
non-member overloads
- C++11 swap (stringstream)
- Reference
- <sstream>
- stringstream
class <sstream>
std::stringstream typedef basic_stringstream<char> stringstream; Input/output string stream
- ios_base
- ios
- istreamostream
- iostream
- stringstream
Stream class to operate on strings. Objects of this class use a
string buffer that contains a sequence of characters. This sequence of characters can be accessed directly as a string object, using member str. Characters can be inserted and/or extracted from the stream using any operation allowed on both
input and
output streams. This is an instantiation of basic_stringstream with the following template parameters:
template parameter | definition | comments |
charT | char | Aliased as member char_type |
traits | char_traits<char> | Aliased as member traits_type |
Alloc | allocator<char> | Aliased as member allocator_type |
Apart from the internal
string buffer, objects of these classes keep a set of internal fields inherited from ios_base, ios and istream:
field | member functions | description |
Formatting | format flags | flagssetfunsetf | A set of internal flags that affect how certain input/output operations are interpreted or generated. See member type fmtflags. |
field width | width | Width of the next formatted element to insert. |
display precision | precision | Decimal precision for the next floating-point value inserted. |
locale | getlocimbue | The locale object used by the function for formatted input/output operations affected by localization properties. |
fill character | fill | Character to pad a formatted field up to the field width (width). |
State | error state | rdstatesetstateclear | The current error state of the stream. Individual values may be obtained by calling good, eof, fail and bad. See member type iostate. |
exception mask | exceptions | The state flags for which a failure exception is thrown. See member type iostate. |
Other | callback stack | register_callback | Stack of pointers to functions that are called when certain events occur. |
extensible arrays | iwordpwordxalloc | Internal arrays to store objects of type long and void*. |
tied stream | tie | Pointer to output stream that is flushed before each i/o operation on this stream. |
stream buffer | rdbuf | Pointer to the associated streambuf object, which is charge of all input/output operations. |
character count | gcount | Count of characters read by last unformatted input operation. |
Member types
The class declares the following member types:
member type | definition |
char_type | char |
traits_type | char_traits<char> |
allocator_type | allocator<char> |
int_type | int |
pos_type | streampos |
off_type | streamoff |
These member types are inherited from its base classes istream, ostream and ios_base:
eventType to indicate event type
(public member type)event_callbackEvent callback function type
(public member type)failureBase class for stream exceptions
(public member class)fmtflagsType for stream format flags
(public member type)InitInitialize standard stream objects
(public member class)iostateType for stream state flags
(public member type)openmodeType for stream opening mode flags
(public member type)seekdirType for stream seeking direction flag
(public member type)sentry (istream)Prepare stream for input
(public member class)sentry (ostream)Prepare stream for output
(public member class) Public member functions
(constructor)Construct object
(public member function)strGet/set content
(public member function)operator= Move assignment
(public member function)swap Swap internals
(public member function) Public member functions inherited from istream
operator>>Extract formatted input
(public member function)gcountGet character count
(public member function)getGet characters
(public member function)getlineGet line
(public member function)ignoreExtract and discard characters
(public member function)peekPeek next character
(public member function)readRead block of data
(public member function)readsomeRead data available in buffer
(public member function)putbackPut character back
(public member function)ungetUnget character
(public member function)tellgGet position in input sequence
(public member function)seekgSet position in input sequence
(public member function)syncSynchronize input buffer
(public member function) Public member functions inherited from ostream
operator<<Insert formatted output
(public member function)putPut character
(public member function)writeWrite block of data
(public member function)tellpGet position in output sequence
(public member function)seekpSet position in output sequence
(public member function)flushFlush output stream buffer
(public member function) Public member functions inherited from ios
goodCheck whether state of stream is good
(public member function)eofCheck whether eofbit is set
(public member function)failCheck whether either failbit or badbit is set
(public member function)badCheck whether badbit is set
(public member function)operator!Evaluate stream (not)
(public member function)operator bool Evaluate stream
(public member function)rdstateGet error state flags
(public member function)setstateSet error state flag
(public member function)clearSet error state flags
(public member function)copyfmtCopy formatting information
(public member function)fillGet/set fill character
(public member function)exceptionsGet/set exceptions mask
(public member function)imbueImbue locale
(public member function)tieGet/set tied stream
(public member function)rdbufGet/set stream buffer
(public member function)narrowNarrow character
(public member function)widenWiden character
(public member function) Public member functions inherited from ios_base
flagsGet/set format flags
(public member function)setfSet specific format flags
(public member function)unsetfClear specific format flags
(public member function)precisionGet/Set floating-point decimal precision
(public member function)widthGet/set field width
(public member function)imbueImbue locale
(public member function)getlocGet current locale
(public member function)xallocGet new index for extensible array [static]
(public static member function)iwordGet integer element of extensible array
(public member function)pwordGet pointer element of extensible array
(public member function)register_callbackRegister event callback function
(public member function)sync_with_stdioToggle synchronization with cstdio streams [static]
(public static member function) Non-member function overloads
swapSwap string streams
(function template) Home page | Privacy policy© cplusplus.com, 2000-2023 - All rights reserved -
v3.3.4s Spotted an error? contact us