The <ios> header declares the classes, types, and manipulator functions that form the foundation of the C++ I/O library, also called iostreams. The class ios_base is the base class for all I/O stream classes. The class template basic_ios derived from ios_base and declares the behavior that is common to all I/O streams, e.g., establishing a stream buffer and defining the I/O state.
Refer to Chapter 10 for more information about input and output, including the use of manipulators, formatting flags, streams, and stream buffers.
The <ios> header includes <iosfwd>.
Base class template for all I/O streams
template <class charT, class traits = char_traits<charT> >
class basic_ios : public ios_base
{
public:
typedef charT char_type;
typedef typename traits::int_type int_type;
typedef typename traits::pos_type pos_type;
typedef typename traits::off_type off_type;
typedef traits traits_type;
// Status:
operator void*();
const bool operator!();
const iostate rdstate() const;
void clear(iostate state = goodbit);
void setstate(iostate state);
bool good() const;
bool eof() const;
bool fail() const;
bool bad() const;
iostate exceptions() const;
void exceptions(iostate except);
explicit basic_ios(basic_streambuf<charT,traits>* sb);
virtual ~basic_ios();
basic_ostream<charT,traits>* tie() const;
basic_ostream<charT,traits>*
tie(basic_ostream<charT,traits>* tiestr);
basic_streambuf<charT,traits>* rdbuf() const;
basic_streambuf<charT,traits>*
rdbuf(basic_streambuf<charT,traits>* sb);
basic_ios& copyfmt(const basic_ios& rhs);
char_type fill() const;
char_type fill(char_type ch);
locale imbue(const locale& loc);
char narrow(char_type c, char deflt) const;
char_type widen(char c) const;
protected:
basic_ios();
void init(basic_streambuf<charT,traits>* buf);
private:
basic_ios(const basic_ios& ); // not defined
basic_ios& operator=(const basic_ios&); // not defined
};
Description
basic_ios()
basic_ios
(const basic_ios& )explicit
basic_ios
(basic_streambuf<charT,traits>* sb)init to initialize the members.init(sb) to initialize the members.
operator void*
()fail() returns true, the void* operator returns a null pointer; otherwise it returns a non-null pointer to indicate success. The most common use for operator void* is as an implicit conversion in a conditional, e.g., while (cin) cin >> data[i++].const bool
operator!
()! operator returns fail().The most common use for operator ! is in a conditional, e.g., if (!cout) cerr << "output error\n".basic_ios&
operator=
(const basic_ios&)bool
bad
() constbad function returns true if badbit is set in rdstate() or false otherwise.void
clear
(iostate state = goodbit)clear function sets the I/O state to state. If rdbuf() is a null pointer, badbit is also set (state | ios_base::badbit). After setting the state, if any state bit is an exception bit ((rdstate() & exceptions()) != 0), basic_ios::failure is thrown.basic_ios&
copyfmt
(const basic_ios& rhs)copyfmt function copies formatting information from rhs. In particular, the format flags, fill character, locale, and the contents of the iword() and pword() arrays are copied. The I/O state and stream buffer are not copied. Before copying any callback functions, each one is called with erase_event. The callbacks are then replaced with those copied from rhs, and each one is called with copyfmt_event. The exceptions() mask is copied last. The return value is *this.bool
eof
() consteof function returns true if eofbit is set in rdstate() or false otherwise.iostate
exceptions
() constvoid
exceptions
(iostate except)exceptions function returns or sets the exception mask. See the clear function for how and when an exception is thrown.bool
fail
() constfail function returns true if badbit is set or failbit is set in rdstate() or false is neither bit is set.char_type
fill
() constchar_type
fill
(char_type ch)fill function returns or changes the fill character (also called the pad character). When setting the fill character, the old fill character is returned.bool
good
() constgood function true if the I/O state is clean, that it, it returns rdstate() == 0.locale
imbue
(const locale& loc)imbue function calls ios_base::imbue(loc) and rdbuf()->pubimbue(loc) (if rdbuf() is not null). The return value is the previous value of ios_base::imbue().void
init
(basic_streambuf<charT,traits>* buf)init function initializes the basic_ios object. Table 13-12 lists the observable effects of initialization. Also, the arrays for iword() and pword() are initially null pointers.| Member function | Return value |
|---|---|
exceptions() |
goodbit |
fill() |
widen(' ') |
flags() |
skipws | dec |
getloc() |
current global locale, that is, std::locale() |
precision() |
6 |
rdbuf() |
buf |
rdstate() |
buf ? goodbit ? badbit |
tie() |
null pointer |
width() |
0 |
char
narrow
(char_type c, char deflt) constnarrow function narrows the character c by returningstd::use_facet<ctype<char_type> >(getloc()).narrow(c, deflt).basic_streambuf<charT,traits>*
rdbuf
() constbasic_streambuf<charT,traits>*
rdbuf
(basic_streambuf<charT,traits>* sb)rdbuf function returns or changes the stream buffer. After changing the stream buffer, the rdbuf function calls clear(); it returns the previous value of rdbuf().const iostate
rdstate
() constrdstate function returns the current I/O state bitmask. See the bad, eof, fail, and good functions for convenient ways to test different bits in the state mask.void
setstate
(iostate state)setstate function sets the specified bits in the I/O state bitmask, that is, it calls clear(rdstate() | state).basic_ostream<charT,traits>*
tie
() constbasic_ostream<charT,traits>*
tie
(basic_ostream<charT,traits>* tiestr)tie function ties a stream (typically an input stream) to an output stream, tiestr. Any input operation on this stream is prefaced by flushing tiestr. Tying streams can be used to ensure prompts appear at the proper time. With no arguments, the tie function returns the currently tied stream, or 0 if no stream is tied.char_type
widen
(char c) constwiden function widens the character c by returning std::use_facet<ctype<char_type> >(getloc()).widen(c).ios_base class, ctype in <locale>, basic_streambuf in <streambuf>
Manipulator for reading and writing bool as text
ios_base& boolalpha(ios_base& stream)
The boolalpha function is a manipulator that sets the boolalpha flag, which tells the stream to read or write a bool value as text, according to the stream's locale. Specifically, the function calls stream.setf(ios_base::boolalpha) and returns stream.
ios_base::fmtflags type, noboolalpha function, ctype in <locale>
Manipulator for decimal integers
ios_base& dec(ios_base& stream)
The dec function is a manipulator that sets the conversion radix to base 10. The function calls stream.setf(ios_base::dec, ios_base::basefield) and returns stream.
hex function, ios_base::fmtflags type, noshowbase function, oct function, showbase function, num_get in <locale>, num_put in <locale>
Manipulator for fixed point output
ios_base& fixed(ios_base&)
The fixed function is a manipulator that sets the floating point output style to fixed point. The function calls stream.setf(ios_base::fixed, ios_base::floatfield) and returns stream.
ios_base::fmtflags type, noshowpoint function, scientific function, showpoint function, num_get in <locale>, num_put in <locale>
Store a file position
template <typename stateT>
class fpos{
public:
stateT state() const;
void state(stateT);
// Following functionality is required, although
// not necessarily as member functions.
fpos(int i);
fpos(streamoff offset);
operator streamoff() const;
bool operator==(const fpos& rhs) const;
bool operator!=(const fpos& rhs) const;
fpos operator+(streamoff offset) const;
fpos operator-(streamoff offset) const;
fpos& operator+=(streamoff offset);
fpos& operator-=(streamoff offset);
streamoff operator-(const fpos& rhs) const;
};
The fpos class template represents a position in a stream. The stateT template parameter is a multibyte shift state, such as mbstate_t. Objects of type fpos can be compared for equality or inequality, subtracted to yield a stream offset, or a stream offset can be added to an fpos position to produce a new fpos. Also, stream offsets can be converted to and from fpos values. Although the declaration in this section shows these functions as member functions, they might be global functions or provided in some other fashion.
streamoff type, mbstate_t in <cwchar>
Manipulator for hexadecimal integers
ios_base& hex(ios_base& stream)
The hex function is a manipulator that sets the conversion radix to base 16. The function calls stream.setf(ios_base::hex, ios_base::basefield) and returns stream.
dec function, ios_base::fmtflags type, noshowbase function, oct function, showbase function,num_get in <locale>, num_put in <locale>
Manipulator to align output on an internal point
ios_base& internal(ios_base& stream)
The internal function is a manipulator that sets the stream's alignment to internal, which typically aligns numbers on their decimal points. The function calls stream.setf(ios_base::internal, ios_base::adjustfield) and returns stream.
ios_base::fmtflags type, left function, right function
Root class for I/O declarations
class ios_base
{
public:
class failure;
typedef ... fmtflags;
typedef ... iostate;
typedef ... openmode;
typedef ... seekdir;
class Init;
// destructor
virtual ~ios_base();
// formatting:
fmtflags flags() const;
fmtflags flags(fmtflags fmtfl);
fmtflags setf(fmtflags fmtfl);
fmtflags setf(fmtflags fmtfl, fmtflags mask);
void unsetf(fmtflags mask);
streamsize precision() const;
streamsize precision(streamsize prec);
streamsize width() const;
streamsize width(streamsize wide);
// locales:
locale imbue(const locale& loc);
locale getloc() const;
// storage:
static int xalloc();
long& iword(int index);
void*& pword(int index);
// callbacks:
enum event { erase_event, imbue_event, copyfmt_event };
typedef void (*event_callback)(event, ios_base&, int index);
void register_callback(event_callback fn, int index);
static bool sync_with_stdio(bool sync = true);
protected:
ios_base();
private:
ios_base(const ios_base&);
ios_base& operator=(const ios_base&);
};
The ios_base class it the root class for all the I/O stream classes. It declares fundamental types that are used throughout the I/O library. It also has members to keep track of formatting for input and output, storage for arbitrary information for derived classes, and registering functions to be called when something interesting happens to the stream object.
Following are the member functions:
ios_base
()
ios_base
(const ios_base&)ios_base. It does not initialize its members. That is left to the basic_ios::init function.ios_base or its derived classes.virtual
~ios_base
()erase_event if the ios_base object has been properly initialized. (See basic_ios::init.)ios_base&
operator=
(const ios_base&)ios_base objects or its derivatives.fmtflags
flags
() constfmtflags
flags
(fmtflags fmtfl)flags function returns the current format flags or sets the flags. When setting the flags, the previous flags are returned.locale
getloc
() constgetloc function returns the stream's currently imbued locale.locale
imbue
(const locale& loc)imbue function saves loc as the new locale and calls all registered callbacks with imbue_event. If the callback function calls getloc, the new locale is returned.long&
iword
(int index)iword function returns a reference to a long integer that is stored in a private array, at index index. If iword has been called before with the same index, a reference to the array element is returned. Otherwise, the array is extended as needed so that index is a valid index, and the new entry is initialized to zero. A reference to the new element is returned.iword with a different indexbasic_ios::copyfmt for this objectiword fails (perhaps because the internal array cannot grow), a reference to a valid long& is returned, whose valid is initially 0. If the object derives from basic_ios<>, badbit is set (which might throw ios_base::failure).xalloc member function to learn how to obtain a suitable index.streamsize
precision
() conststreamsize
precision
(streamsize prec)precision function returns or sets the precision (places after the decimal point) used to format floating point numbers for output. When setting a new precision, the previous precision is returned.void*&
pword
(int index)pword function returns a reference to a void* that is stored in a private array, at index index. If pword has been called before with the same index, a reference to the array element is returned. Otherwise, the array is extended as needed so that index is a valid index, and the new entry is initialized to a null pointer. A reference to the new element is returned.pword with a different indexbasic_ios::copyfmt for this objectpword fails (perhaps because the internal array cannot grow), a reference to a valid void*& is returned, whose valid is initially 0. If the object derives from basic_ios<>, badbit is set (which might throw ios_base::failure).xalloc member function to learn how to obtain a suitable index.void
register_callback
(event_callback fn, int index)register_callback function lets you register a function fn to be called when one of three events occurs for the ios_base object:erase_event)copyfmt is called (erase_event followed by copyfmt_event)imbue is called (imbue_event)index. The index is passed to the callback function. Functions are called in the opposite order of registrationpword array. When copyfmt is called, the string should also be copied. Example 13-17 shows how to use callbacks to make sure the memory is managed properly.Example 13-17: Copying information associated with streams
void manage_info(std::ios_base::event event,
std::ios_base& stream, int index)
{
infostruct* ip;
switch(event) {
case std::ios_base::erase_event:
ip = stream.pword(index);
stream.pword(index) = 0;
delete ip;
break;
case std::ios_base::copyfmt_event:
stream.pword(index) = new infostruct;
break;
default:
break; // imbue_event does not affect storage
}
}
void openread(std::ifstream& f, const char* name)
{
f.open(name);
int index = f.xalloc();
f.pword(index) = new infostruct;
f.register_callback(manage_info, index);
}
fmtflags
setf
(fmtflags addflags)setf function sets the addflags bits of the formatting flags. It is equivalent to calling flags(flags | addflags).fmtflags
setf
(fmtflags newflags, fmtflags mask)setf function clears the mask bits from the formatting flags and then sets the newflags & mask bits. It is equivalent to calling flags((flags() & ~mask) | (newflags & mask)). The two-argument version of setf is most often used with multiple-choice flags, e.g., setf(ios_base::dec, ios_base::basefield).static bool
sync_with_
st
dio
(bool sync = true)sync_with_stdio function determines whether C++ I/O is synchronized with the C I/O functions. Initially, the two are synchronized.sync_with_stdio(false) after any I/O has been performed, the behavior is implementation-defined.void
unsetf
(fmtflags mask)unsetf function clears the mask bits from the formatting flags. It is equivalent to calling flags(flags() & ~mask).streamsize
width
() conststreamsize
width
(streamsize wide)width function returns or sets the minimum field width. When setting the width, the previous width is returned.static int
xalloc
()xalloc function returns a unique integer, suitable for use as an index to the iword or pword functions. You can think of ios_base as having a static integer data member, xalloc_index, and xalloc is implemented so it returned xalloc_index++.basic_ios class template
Callback event type
enum event { erase_event, imbue_event, copyfmt_event };
The ios_base::event type denotes an interesting event in the lifetime of an I/O stream object. See the register_callback function in the ios_base class, earlier in this section, to learn how to register a function that is called when one of these events occurs.
ios_base class, ios_base::event_callback type
Callback function type
typedef void (*event_callback)(event, ios_base&, int index);
The ios_base::event_callback type denotes a callback function. See the register_callback function in the ios_base class, earlier in this section, to learn how to register a callback function, which a stream object calls when an interesting event occurs.
ios_base class, ios_base::event type
Exception class for I/O failure
class ios_base::failure : public exception
{
public:
explicit failure(const string& msg);
virtual ~failure();
virtual const char* what() const throw();
};
The ios_base::failure class is the base class for I/O-related exceptions. Its use of the constructor's msg parameter and what() member function are consistent with the conventions of the exception class.
basic_ios::clear function, exception in <exception>
Formatting flags
typedef ... fmtflags; static const fmtflags boolalpha; static const fmtflags dec; static const fmtflags fixed; static const fmtflags hex; static const fmtflags internal; static const fmtflags left; static const fmtflags oct; static const fmtflags right; static const fmtflags scientific; static const fmtflags showbase; static const fmtflags showpoint; static const fmtflags showpos; static const fmtflags skipws; static const fmtflags unitbuf; static const fmtflags uppercase; static const fmtflags adjustfield; static const fmtflags basefield; static const fmtflags floatfield;
The fmtflags type is an integer, enum, or bitmask type (the exact type is implementation-defined) that represents formatting flags for input and output. In the ios_base class, several static constants are also defined, as enumerated literals or as explicit constants. Table 13-12 lists the flag literals. Table 13-13 lists additional constants that are used as masks for the ios_base::setf function.
| Literal name | Description |
|---|---|
boolalpha |
Read and write bool values as text, according to the locale |
dec |
Read and write decimal integers |
fixed |
Write floating point values in fixed notation |
hex |
Read and write hexadecimal integers |
internal |
Align output to internal point, e.g., decimal point |
left |
Left align output |
oct |
Read and write octal integers |
right |
Right align output |
scientific |
Write floating point values in scientific notation |
showbase |
Write a prefix for integer radix, e.g., 0x for hexadecimal |
showpoint |
Write decimal point, even if not needed |
showpos |
Write plus sign (+), even if not needed |
skipws |
Skip white space before input |
unitbuf |
Flush output after each operation |
uppercase |
Use uppercase in generated output, e.g., 0X prefix |
| Constant name | Value |
|---|---|
adjustfield |
left | internal | right |
basefield |
dec | hex | oct |
floatfield |
fixed | scientific |
<bitset>, ctype in <locale>, num_get in <locale>, num_put in <locale>
Initialization class
class ios_base::Init {
public:
Init();
~Init();
};
The Init class is used to ensure the construction of the standard I/O stream objects. The first time an ios_base::Init object is constructed, it constructs and initializes cin, cout, cerr, clog, wcin, wcout, wcerr, and wclog. A static counter keeps track of the number of times ios_base::Init is constructed and destructed. When the last instance is destroyed, flush() is called for each of cout, cerr, clog, wcout, wcerr, and wclog.
For example, suppose a program constructs a static object, and the constructor prints a warning to cerr if certain conditions hold. To ensure cerr is properly initialized and ready to receive output, declare an ios_base::Init object before your static object, as shown in Example 13-16.
Example 13-16: Ensuring proper initialization of standard I/O streams
class myclass {
public:
myclass() {
if (! okay())
std::cerr << "Oops: not okay!\n";
}
};
static std::ios_base::Init init;
static myclass myobject;
<iostream>
I/O status
typedef ... iostate; static const iostate badbit static const iostate eofbit static const iostate failbit static const iostate goodbit = iostate(0);
The ios_base::iostate type is an integer, enum, or bitset type (the exact type is implementation defined) that represents the status of an I/O stream. Table 13-14 lists the iostate literals and their meanings. The basic_ios class template has several member functions for setting, testing, and clearing iostate bits.
| Literal | Description |
|---|---|
badbit |
Irrecoverable error, such as a null streambuf pointer or a write failure |
eofbit |
End of file when reading |
failbit |
Failure to read or write expected characters, e.g., trying to read an integer from non-numeric input |
goodbit |
No problems; value is zero |
basic_ios class template, <bitset>
Open mode bits
typedef ... openmode; static const openmode app static const openmode ate static const openmode binary static const openmode in static const openmode out static const openmode trunc
The ios_base::openmode type is an integer, enum, or bitset type (the exact type is implementation-defined) that defines the mode for opening a file. Table 13-15 lists the openmode literals and their meanings. Refer to the <fstream> section of this chapter for the most common use of ios_base::openmode and the permitted combinations of openmode literals. The openmode type is also used for the basic_streambuf::pubseekoff and pubseekpos functions and related functions.
| Literal | Description |
|---|---|
app |
Seek to end of file before each write |
ate |
Seek to end of file immediately after opening |
binary |
Read and write is binary mode (default is text) |
in |
Open for input (reading) |
out |
Open for output (writing) |
trunc |
Truncate file to zero length |
<bitset>, basic_filebuf in <fstream>, basic_streambuf in <streambuf>
Seek direction
typedef ... ios_base::seekdir static const seekdir beg static const seekdir cur static const seekdir end
The ios_base::seekdir type is an enumerated type that contains the literals listed in Table 13-16. Note that the order and integer values of the literals is implementation-defined. The seekdir type is used to specify a seek direction when changing a file's position, which is typically expressed as a numeric offset relative to a seekdir origin.
| Literal | Description |
|---|---|
beg |
Seek from the beginning of the stream, e.g., offset is absolute position |
cur |
Seek from the current position; positive is towards end of stream, and negative offsets are towards the beginning of the stream |
end |
Seek relative to the end of the stream; negative offsets are towards the beginning |
basic_istream in <istream>, basic_ostream in <ostream>, basic_streambuf in <streambuf>
Manipulator to left-align output
ios_base& left(ios_base& stream)
The left function is a manipulator that selects left-alignment for output to stream. The function calls stream.setf(ios_base::left, ios_base::adjustfield) and returns stream.
internal function, ios_base::fmtflags type, right function
Manipulator to disable reading and writing bool as text
ios_base& noboolalpha(ios_base& stream)
The noboolalpha function is a manipulator that clears the boolalpha flag, which tells the stream to read or write a bool value as an integer. Specifically, the function calls stream.unsetf(ios_base::boolalpha) and returns stream.
boolalpha function, ios_base::fmtflags type, ctype in <locale>
Manipulator to disable showing output radix
ios_base& noshowbase(ios_base& stream)
The noshowbase function is a manipulator that clears the showbase flag, which tells an output stream to write a prefix for integer output: 0x for hexadecimal or 0 for octal. Specifically, the function calls stream.unsetf(ios_base::showbase) and returns stream.
hex function, ios_base::fmtflags type, oct function, nouppercase function, showbase function, uppercase function, num_put in <locale>
Manipulator to suppress unnecessary decimal points
ios_base& noshowpoint(ios_base& stream)
The noshowpoint function is a manipulator that clears the showpoint flag, which tells an output stream to write a decimal point for floating point output, even if the point is unnecessary (only zeros appear after the decimal point). Specifically, the function calls stream.unsetf(ios_base::showpoint) and returns stream.
fixed function, ios_base::fmtflags type, scientific function, showpoint function, num_put in <locale>
Manipulator to suppress + sign in non-negative output
ios_base& noshowpos(ios_base& stream)
The noshowpos function is a manipulator that clears the showpos flag, which tells an output stream to write a plus (+) sign, even if the point is unnecessary (the value is zero or positive). Specifically, the function calls stream.unsetf(ios_base::showpos) and returns stream.
ios_base::fmtflags type, showpos function, num_put in <locale>
Manipulator to disable skipping white space before reading
ios_base& noskipws(ios_base& stream)
The noskipws function is a manipulator that clears the skipws flag, which tells an input stream to skip white space before reading most fields. Specifically, the function calls stream.unsetf(ios_base::skipws) and returns stream.
ios_base::fmtflags type, skipws function, num_get in <locale>
Manipulator to use lowercase in generated output
ios_base& nouppercase(ios_base& stream)
The nouppercase function is a manipulator that clears the uppercase flag, which tells an output stream to use uppercase letters for generated output, e.g., 0X for hexadecimal prefix or E for exponents. Specifically, the function calls stream.unsetf(ios_base::uppercase) and returns stream.
hex function, ios_base::fmtflags type, scientific function, uppercase function, num_put in <locale>
Manipulator for octal integers
ios_base& oct(ios_base& stream)
The oct function is a manipulator that sets the conversion radix to base 8. The function calls stream.setf(ios_base::oct, ios_base::basefield) and returns stream.
dec function, hex function, ios_base::fmtflags type, noshowbase function, showbase function, num_get in <locale>, num_put in <locale>
Manipulator to right-align output
ios_base& right(ios_base& stream)
The right function is a manipulator that selects right-alignment for output to stream. The function calls stream.setf(ios_base::right, ios_base::adjustfield) and returns stream.
internal function, ios_base::fmtflags type, left function
Manipulator to use scientific notation for output
ios_base& scientific(ios_base&)
The fixed function is a manipulator that sets the floating point output style to scientific or exponential notation. The function calls stream.setf(ios_base::scientific, ios_base::floatfield) and returns stream.
fixed function, ios_base::fmtflags type, num_get in <locale>, num_put in <locale>
Manipulator to show output radix
ios_base& showbase(ios_base& stream)
The showbase function is a manipulator that sets the showbase flag, which tells an output stream to write a prefix for integer output: 0x for hexadecimal or 0 for octal. Specifically, the function calls stream.setf(ios_base::showbase) and returns stream.
hex function, ios_base::fmtflags type, oct function, noshowbase function, nouppercase function, uppercase function, num_put in <locale>
Manipulator to show decimal point even when unnecessary
ios_base& showpoint(ios_base& stream)
The showpoint function is a manipulator that sets the showpoint flag, which tells an output stream to write a decimal point for floating point output, even if the point is unnecessary (only zeros appear after the decimal point). Specifically, the function calls stream.setf(ios_base::showpoint) and returns stream.
fixed function, ios_base::fmtflags type, noshowpoint function, scientific function, num_put in <locale>
Manipulator to show + sign for non-negative numbers
ios_base& showpos(ios_base& stream)
The showpos function is a manipulator that sets the showpos flag, which tells an output stream to write a plus (+) sign, even if the point is unnecessary (the value is zero or positive). Specifically, the function calls stream.setf(ios_base::showpos) and returns stream.
ios_base::fmtflags type, noshowpos function, num_put in <locale>
Manipulator to skip white space before reading
ios_base& skipws(ios_base& stream)
The skipws function is a manipulator that sets the skipws flag, which tells an input stream to skip white space before reading most fields. Specifically, the function calls stream.setf(ios_base::skipws) and returns stream.
ios_base::fmtflags type, noskipws function, num_get in <locale>
Stream offset type
typedef ... streamoff
The streamoff type is an implementation-defined type that represents a signed offset in a stream. See the fpos type for more information about working with file positions and offsets.
fpos type, char_traits in <string>
Stream size type
typedef ... streamsize
The streamsize type is an implementation-defined type that is used to represent the size of various stream entities, such as number of characters to read or write. It is a synonym for one of the signed integral types. You can convert a streamoff to a streamsize and vice versa without loss of information.
Manipulator to use uppercase for generated output
ios_base& uppercase(ios_base& stream)
The uppercase function is a manipulator that sets the uppercase flag, which tells an output stream to use uppercase letters for generated output, e.g., 0X for hexadecimal prefix or E for exponents. Specifically, the function calls stream.setf(ios_base::uppercase) and returns stream.
hex function, ios_base::fmtflags type, nouppercase function, scientific function, num_put in <locale>