Type |
Name |
Effect |
istream |
cin |
Reads input from the standars
input channel |
ostream |
cout |
Writes output to the standard
output channel |
ostream |
cerr |
Writes error messages to the
error output channel |
ostream |
clog |
Writes log messages to the
standard logging channel |
wistream |
wcin |
Reads wide-character input from
the standars input channel |
wostream |
wcout |
Writes wide-character output to
the standard output channel |
wostream |
wcerr |
Writes wide-character to the
error output channel |
wostream |
wclog |
Writes wide-character log to the
standard logging channel |
Constant |
Meaning |
goodbit |
Everithing is OK |
eofbit |
End-of-file was encountered |
failbit |
Error; an I/O operation was
not successful |
badbit |
Fatal error |
Function |
Meaning |
good( ) |
Returns true if the stream
is OK (ie: if goodbit is set) |
eof( ) |
Returns true if end-of-file
was hit (ie: eofbit is set) |
fail( ) |
Returns true if an error
has occured (ie: failbit or badbit is set) |
bad( ) |
Returns true if a fatal error
has occured (ie: badbit is set) |
rdstate( ) |
Returns the currently set flags |
clear( ) |
Clears all flags |
clear(state) |
Clears all sets state flags |
setstate(state) |
Sets additional state flags |
Manipulator |
Effect |
endl |
Output '\n' and flushes the
output buffer |
flush |
flushes the output buffer |
ws |
Reads and discard whitespaces |
uppercase |
All the characters are written
as uppercase |
nouppercase | All the characters are written
with no uppercase |
dec |
Converts into base 10 |
hex |
Converts into base 16 |
oct |
Converts into base 8 |
fixed |
Using floating point format |
scientific
|
Using scientific format |
Manipulator |
Effect |
setbase
(n) |
Output integers in base b (b
must be 8, 10 or 16) |
setprecision (n) | Rounds of n digits after decimal
point |
Operation |
Effect |
string s |
Creates an empty string s |
string s (str) | Creates a string s that is the
copy of the existing string str |
string s (str,str_idx) | Creates a string s with the values of the existing string str starting with index str_idx |
string s(str,str_idx,str_len) | Creates a string s with the values of the existing string str starting with index str_idx, but having at most str_len elements |
strings s (num,c) | Creates a string s initialized with num occurences of the character c |
strings s (beg,end) |
Creates a string s initialized
with all the characters in the range [beg,end) |
s.clear( ) |
makes s empty |
Operation |
Effect |
s.capacity(
), s.lenght( ) |
Returns the maximum possible
number of elements without reallocation |
s.reserve(my_value)
|
Enlarges capacity, if not enough
yet |
s.max_size(
) |
Returns the maximum number of
characters a string may contain |
s.empty(
) |
Returns whether the string s is
empty |
s.find
(charac) |
returns the first occurence of
value |
s.find (charac,idx) | returns the first occurence of
value starting from index idx |
s.rfind (charac) | returns the first occurence of
value in the reverse order |
s.find_first_of (charac) | finds the first character that
is part of charac |
s.find_last_of (charac) | finds the last character that is
part of charac |
s.find_first_not_of (charac) | finds the first character that
is not part of charac |
s.find_last_not_of (charac) | finds the last character that is
not part of charac |
s.substr(
) |
returns s |
s.substr(idx) | returns the range starting from
idx (included) to the end of s; s.substr( ) returns s |
s.substr(N,idx) | returns the N values of s
starting from index idx |
Operation |
Effect |
s.at(idx) |
Returns the element with index
idx (throws range exception if idx is out of range) |
s[idx] |
Returns the element with index idx with no range checking |
Operation |
Effect |
s.assign(str) |
Assigns s with the string str |
s.assign(str,idx1,idx2) | Assigns s with the values in the range [idx1,idx2] in string str |
s1.swap(s2) | Swap s1 and s2 |
s.append(str) |
Appends str to s |
s.append(str,idx1,idx2) | Appends the elements in the range[idx1,idx2] of str to s |
s.append(N,charac) | Appends N times the character
charac |
s.insert(posi,str) |
Inserts str at position posi |
s.replace(idx1,idx2,str) | Replaces the range [idx1,idx2]
in s with str (str does not have necessarily the same lenght than
[idx1,idx2] |
s.erase(idx) | Erases all the elements in s
starting from index idx (including idx) |
s.erase(N,idx) | Erases the N values starting
with idx (including idx) |
Operation |
Effect |
ssg.str(
) |
Returns the buffer as a string |
ssg.str(string_val) | Sets the contents of the buffer
as a_string_val |