7.5.1
Stream Input/Output Class Library
The header files for stream input/output class libraries are as follows:
Defines data members and function members that specify input/output formats and manage the input/output states. The <ios> header file also defines the Init and ios_base classes in addition to the ios class.
Defines functions for the stream buffer.
Defines input functions from the input stream.
Defines output functions to the output stream.
Defines input/output functions.
Defines manipulators with parameters.
The following shows the inheritance relation of the above classes. An arrow (->) indicates that a derived class references a base class. The streambuf class has no inheritance relation.
The following types are used by stream input/output class libraries.
|
|
|
Type
|
streamoff
|
Defined as long type.
|
streamsize
|
Defined as size_t type.
|
int_type
|
Defined as int type.
|
pos_type
|
Defined as long type.
|
off_type
|
Defined as long type.
|
|
|
|
Variable
|
init_cnt
|
Static data member that counts the number of stream input/output objects. The data must be initialized to 0 by a low-level interface.
|
Function
|
Init()
|
Constructor.
|
~Init()
|
Destructor.
|
Constructor of class Init.
Increments init_cnt.
Destructor of class Init.
Decrements init_cnt.
|
|
|
Type
|
fmtflags
|
Type that indicates the format control information.
|
iostate
|
Type that indicates the stream buffer input/output state.
|
openmode
|
Type that indicates the open mode of the file.
|
seekdir
|
Type that indicates the seek state of the stream buffer.
|
Variable
|
fmtfl
|
Format flag.
|
wide
|
Field width.
|
prec
|
Precision (number of decimal point digits) at output.
|
fillch
|
Fill character.
|
Function
|
void _ec2p_init_base()
|
Initializes the base class.
|
void _ec2p_copy_base(
ios_base&ios_base_dt)
|
Copies ios_base_dt.
|
ios_base()
|
Constructor.
|
~ios_base()
|
Destructor.
|
fmtflags flags() const
|
References the format flag (fmtfl).
|
fmtflags flags(fmtflags fmtflg)
|
Sets fmtflg&format flag (fmtfl) to the format flag (fmtfl).
|
fmtflags setf(fmtflags fmtflg)
|
Sets fmtflg to format flag (fmtfl).
|
fmtflags setf(
fmtflags fmtflg,
fmtflags mask)
|
Sets mask&fmtflg to the format flag (fmtfl).
|
void unsetf(fmtflags mask)
|
Sets ~mask&format flag (fmtfl) to the format flag (fmtfl).
|
char fill() const
|
References the fill character (fillch).
|
char fill(char ch)
|
Sets ch as the fill character (fillch).
|
int precision() const
|
References the precision (prec).
|
streamsize precision(
streamsize preci)
|
Sets preci as precision (prec).
|
streamsize width() const
|
References the field width (wide).
|
streamsize width(streamsize wd)
|
Sets wd as field width (wide).
|
Defines the format control information relating to input/output processing.
The definition for each bit mask of fmtflags is as follows:
const ios_base::fmtflags ios_base::boolalpha
|
= 0x0000;
|
const ios_base::fmtflags ios_base::skipws
|
= 0x0001;
|
const ios_base::fmtflags ios_base::unitbuf
|
= 0x0002;
|
const ios_base::fmtflags ios_base::uppercase
|
= 0x0004;
|
const ios_base::fmtflags ios_base::showbase
|
= 0x0008;
|
const ios_base::fmtflags ios_base::showpoint
|
= 0x0010;
|
const ios_base::fmtflags ios_base::showpos
|
= 0x0020;
|
const ios_base::fmtflags ios_base::left
|
= 0x0040;
|
const ios_base::fmtflags ios_base::right
|
= 0x0080;
|
const ios_base::fmtflags ios_base::internal
|
= 0x0100;
|
const ios_base::fmtflags ios_base::adjustfield
|
= 0x01c0;
|
const ios_base::fmtflags ios_base::dec
|
= 0x0200;
|
const ios_base::fmtflags ios_base::oct
|
= 0x0400;
|
const ios_base::fmtflags ios_base::hex
|
= 0x0800;
|
const ios_base::fmtflags ios_base::basefield
|
= 0x0e00;
|
const ios_base::fmtflags ios_base::scientific
|
= 0x1000;
|
const ios_base::fmtflags ios_base::fixed
|
= 0x2000;
|
const ios_base::fmtflags ios_base::floatfield
|
= 0x3000;
|
const ios_base::fmtflags ios_base::_fmtmask
|
= 0x3fff;
|
Defines the input/output state of the stream buffer.
The definition for each bit mask of iostate is as follows:
const ios_base::iostate ios_base::goodbit
|
= 0x0;
|
const ios_base::iostate ios_base::eofbit
|
= 0x1;
|
const ios_base::iostate ios_base::failbit
|
= 0x2;
|
const ios_base::iostate ios_base::badbit
|
= 0x4;
|
const ios_base::iostate ios_base::_statemask
|
= 0x7;
|
Defines open mode of the file.
The definition for each bit mask of openmode is as follows:
const ios_base::openmode ios_base::in
|
= 0x01;
|
Opens the input file.
|
const ios_base::openmode ios_base::out
|
= 0x02;
|
Opens the output file.
|
const ios_base::openmode ios_base::ate
|
= 0x04;
|
Seeks for eof only once after the file has been opened.
|
const ios_base::openmode ios_base::app
|
= 0x08;
|
Seeks for eof each time the file is written to.
|
const ios_base::openmode ios_base::trunc
|
= 0x10;
|
Opens the file in overwrite mode.
|
const ios_base::openmode ios_base::binary
|
= 0x20;
|
Opens the file in binary mode.
|
Defines the seek state of the stream buffer.
Determines the position in a stream to continue the input/output of data.
The definition for each bit mask of seekdir is as follows:
const ios_base::seekdir ios_base::beg
|
= 0x0;
|
const ios_base::seekdir ios_base::cur
|
= 0x1;
|
const ios_base::seekdir ios_base::end
|
= 0x2;
|
void ios_base::_ec2p_init_base()
|
The initial settings are as follows:
fmtfl = skipws | dec;
wide = 0;
prec = 6;
fillch = ’ ’;
void ios_base::_ec2p_copy_base(ios_base& ios_base_dt)
|
Copies ios_base_dt.
Constructor of class ios_base.
Calls Init::Init().
Destructor of class ios_base.
ios_base::fmtflags ios_base::flags() const
|
References the format flag (fmtfl).
Return value: Format flag (fmtfl).
ios_base::fmtflags ios_base::flags(fmtflags fmtflg)
|
Sets fmtflg&format flag (fmtfl) to the format flag (fmtfl).
Return value: Format flag (fmtfl) before setting.
ios_base::fmtflags ios_base::setf(fmtflags fmtflg)
|
Sets fmtflg to the format flag (fmtfl).
Return value: Format flag (fmtfl) before setting.
ios_base::fmtflags ios_base::setf((fmtflags fmtflg, fmtflags mask)
|
Sets the mask&fmtflg value to the format flag (fmtfl).
Return value: Format flag (fmtfl) before setting.
void ios_base::unsetf(fmtflags mask)
|
Sets ~mask&format flag (fmtfl) to the format flag (fmtfl).
char ios_base::fill() const
|
References the fill character (fillch).
Return value: Fill character (fillch).
char ios_base::fill(char ch)
|
Sets ch as the fill character (fillch).
Return value: Fill character (fillch) before setting.
int ios_base::precision() const
|
References the precision (prec).
Return value: Precision (prec).
streamsize ios_base::precision(streamsize preci)
|
Sets preci as the precision (prec).
Return value: Precision (prec) before setting.
streamsize ios_base::width() const
|
References the field width (wide).
Return value: Field width (wide).
streamsize ios_base::width(streamsize wd)
|
Sets wd as the field width (wide).
Return value: Field width (wide) before setting.
|
|
|
Variable
|
sb
|
Pointer to the streambuf object.
|
tiestr
|
Pointer to the ostream object.
|
state
|
State flag of streambuf.
|
Function
|
ios()
|
Constructor.
|
ios(streambuf* sbptr)
|
void init(streambuf* sbptr)
|
Performs initial setting.
|
virtual ~ios()
|
Destructor.
|
operator void*() const
|
Tests whether an error has been generated (!state&(badbit | failbit).
|
bool operator!() const
|
Tests whether an error has been generated (state&(badbit | failbit)).
|
iostate rdstate() const
|
References the state flag (state).
|
void clear(iostate st = goodbit)
|
Clears the state flag (state) except for the specified state (st).
|
void setstate(iostate st)
|
Specifies st as the state flag (state).
|
bool good() const
|
Tests whether an error has been generated (state==goodbit).
|
bool eof() const
|
Tests for the end of an input stream (state&eofbit).
|
bool bad() const
|
Tests whether an error has been generated (state&badbit).
|
bool fail() const
|
Tests whether the input text matches the requested pattern (state&(badbit | failbit)).
|
ostream* tie() const
|
References the pointer to the ostream object (tiestr).
|
ostream* tie(ostream* tstrptr)
|
Sets tstrptr as the pointer to the ostream object (tiestr).
|
streambuf* rdbuf() const
|
References the pointer to the streambuf object (sb).
|
streambuf* rdbuf(streambuf* sbptr)
|
Sets sbptr as the pointer to the streambuf object (sb).
|
ios& copyfmt(const ios& rhs)
|
Copies the state flag (state) of rhs.
|
Constructor of class ios.
Calls init(0) and sets the initial value to the member object.
ios::ios(streambuf* sbptr)
|
Constructor of class ios.
Calls init(sbptr) and sets the initial value to the member object.
void ios::init(streambuf* sbptr)
|
Sets sbptr to sb.
Sets state and tiestr to 0.
Destructor of class ios.
ios::operator void*() const
|
Tests whether an error has been generated (!state&(badbit | failbit)).
Return value: An error has been generated: false
No error has been generated: true
bool ios::operator!() const
|
Tests whether an error has been generated (state&(badbit | failbit)).
Return value: An error has been generated: true
No error has been generated: false
iostate ios::rdstate() const
|
References the state flag (state).
Return value: State flag (state).
void ios::clear(iostate st = goodbit)
|
Clears the state flag (state) except for the specified state (st).
If the pointer to the streambuf object (sb) is 0, badbit is set to the state flag (state).
void ios::setstate(iostate st)
|
Sets st to the state flag (state).
Tests whether an error has been generated (state==goodbit).
Return value: An error has been generated: false
No error has been generated: true
Tests for the end of the input stream (state&eofbit).
Return value: End of the input stream has been reached: true
End of the input stream has not been reached: false
Tests whether an error has been generated (state&badbit).
Return value: An error has been generated: true
No error has been generated: false
Tests whether the input text matches the requested pattern (state&(badbit | failbit)).
Return value: Does not match the requested pattern: true
Matches the requested pattern: false
ostream* ios::tie() const
|
References the pointer (tiestr) to the ostream object.
Return value: Pointer to the ostream object (tiestr).
ostream* ios::tie(ostream* tstrptr)
|
Sets tstrptr as the pointer (tiestr) to the ostream object.
Return value: Pointer to the ostream object (tiestr) before setting.
streambuf* ios::rdbuf() const
|
References the pointer to the streambuf object (sb).
Return value: Pointer to the streambuf object (sb).
streambuf* ios::rdbuf(streambuf* sbptr)
|
Sets sbptr as the pointer to the streambuf object (sb).
Return value: Pointer to the streambuf object (sb) before setting.
ios& ios::copyfmt(const ios& rhs)
|
Copies the state flag (state) of rhs.
Return value: *this
(d) | ios Class Manipulators |
|
|
|
Function
|
ios_base& showbase(ios_base& str)
|
Specifies the radix display prefix mode.
|
ios_base& noshowbase(ios_base& str)
|
Clears the radix display prefix mode.
|
ios_base& showpoint(ios_base& str)
|
Specifies the decimal-point generation mode.
|
ios_base& noshowpoint(ios_base& str)
|
Clears the decimal-point generation mode.
|
ios_base& showpos(ios_base& str)
|
Specifies the + sign generation mode.
|
ios_base& noshowpos(ios_base& str)
|
Clears the + sign generation mode.
|
ios_base& skipws(ios_base& str)
|
Specifies the space skipping mode.
|
ios_base& noskipws (ios_base& str)
|
Clears the space skipping mode.
|
ios_base& uppercase(ios_base& str)
|
Specifies the uppercase letter conversion mode.
|
ios_base& nouppercase(ios_base& str)
|
Clears the uppercase letter conversion mode.
|
ios_base& internal(ios_base& str)
|
Specifies the internal fill mode.
|
ios_base& left(ios_base& str)
|
Specifies the left side fill mode.
|
ios_base& right(ios_base& str)
|
Specifies the right side fill mode.
|
ios_base& dec(ios_base& str)
|
Specifies the decimal mode.
|
ios_base& hex(ios_base& str)
|
Specifies the hexadecimal mode.
|
ios_base& oct(ios_base& str)
|
Specifies the octal mode.
|
ios_base& fixed(ios_base& str)
|
Specifies the fixed-point mode.
|
ios_base& scientific(ios_base& str)
|
Specifies the scientific description mode.
|
ios_base& showbase(ios_base& str)
|
Specifies an output mode of prefixing a radix at the beginning of data.
For a hexadecimal, 0x is prefixed. For a decimal, nothing is prefixed. For an octal, 0 is prefixed.
Return value: str
ios_base& noshowbase(ios_base& str)
|
Clears the output mode of prefixing a radix at the beginning of data.
Return value: str
ios_base& showpoint(ios_base& str)
|
Specifies the output mode of showing the decimal point.
If no precision is specified, six decimal-point (fraction) digits are displayed.
Return value: str
ios_base& noshowpoint(ios_base& str)
|
Clears the output mode of showing the decimal point.
Return value: str
ios_base& showpos(ios_base& str)
|
Specifies the output mode of generating the + sign (adds a + sign to a positive number).
Return value: str
ios_base& noshowpos(ios_base& str)
|
Clears the output mode of generating the + sign.
Return value: str
ios_base& skipws(ios_base& str)
|
Specifies the input mode of skipping spaces (skips consecutive spaces).
Return value: str
ios_base& noskipws(ios_base& str)
|
Clears the input mode of skipping spaces.
Return value: str
ios_base& uppercase(ios_base& str)
|
Specifies the output mode of converting letters to uppercases.
In hexadecimal, the radix will be uppercase letters 0X, and the numeric value letters will be uppercase letters. The exponential representation of a floating-point value will also use uppercase letter E.
Return value: str
ios_base& nouppercase(ios_base& str)
|
Clears the output mode of converting letters to uppercases.
Return value: str
ios_base& internal(ios_base& str)
|
When data is output in the field width (wide) range, it is output in the order of
Sign and radix
Fill character (fill)
Numeric value
Return value: str
ios_base& left(ios_base& str)
|
When data is output in the field width (wide) range, it is aligned to the left.
Return value: str
ios_base& right(ios_base& str)
|
When data is output in the field width (wide) range, it is aligned to the right.
Return value: str
ios_base& dec(ios_base& str)
|
Specifies the conversion radix to the decimal mode.
Return value: str
ios_base& hex(ios_base& str)
|
Specifies the conversion radix to the hexadecimal mode.
Return value: str
ios_base& oct(ios_base& str)
|
Specifies the conversion radix to the octal mode.
Return value: str
ios_base& fixed(ios_base& str)
|
Specifies the fixed-point output mode.
Return value: str
ios_base& scientific(ios_base& str)
|
Specifies the scientific description output mode (exponential description).
Return value: str
|
|
|
Constant
|
eof
|
Indicates the end of the file.
|
Variable
|
_B_cnt_ptr
|
Pointer to the length of valid data in the buffer.
|
B_beg_ptr
|
Pointer to the base pointer of the buffer.
|
_B_len_ptr
|
Pointer to the length of the buffer.
|
B_next_ptr
|
Pointer to the next position of the buffer from which data is to be read.
|
B_end_ptr
|
Pointer to the end position of the buffer.
|
B_beg_pptr
|
Pointer to the start position of the control buffer.
|
B_next_pptr
|
Pointer to the next position of the buffer from which data is to be read.
|
C_flg_ptr
|
Pointer to the input/output control flag of the file.
|
Function
|
char* _ec2p_getflag() const
|
References the pointer for the file input/output control flag.
|
char*& _ec2p_gnptr()
|
References the pointer to the next position of the buffer from which data is to be read.
|
char*& _ec2p_pnptr()
|
References the pointer to the next position of the buffer where data is to be written.
|
void _ec2p_bcntplus()
|
Increments the valid data length of the buffer.
|
void _ec2p_bcntminus()
|
Decrements the valid data length of the buffer.
|
void _ec2p_setbPtr(
char** begptr,
char** curptr,
long* cntptr,
long* lenptr,
char* flgptr)
|
Sets the pointers of streambuf.
|
streambuf()
|
Constructor.
|
virtual ~streambuf()
|
Destructor.
|
streambuf* pubsetbuf(char* s,
streamsize n)
|
Allocates the buffer for stream input/output.
This function calls setbuf (s,n)*1.
|
pos_type pubseekoff(
off_type off,
ios_base::seekdir way,
ios_base::openmode
which = ios_base::in | ios_base::out)
|
Moves the position to read or write data in the input/output stream by using the method specified by way.
This function calls seekoff(off,way,which)*1.
|
pos_type pubseekpos(
pos_type sp,
ios_base::openmode
which = ios_base::in | ios_base::out)
|
Calculates the offset from the beginning of the stream to the current position.
This function calls seekpos(sp,which)*1.
|
int pubsync()
|
Flushes the output stream.
This function calls sync()*1.
|
streamsize in_avail()
|
Calculates the offset from the end of the input stream to the current position.
|
int_type snextc()
|
Reads the next character.
|
Function
|
int_type sbumpc()
|
Reads one character and sets the pointer to the next character.
|
int_type sgetc()
|
Reads one character.
|
int sgetn(char* s, streamsize n)
|
Reads n characters and sets them in the memory area specified by s.
|
int_type sputbackc(char c)
|
Puts back the read position.
|
int sungetc()
|
Puts back the read position.
|
int sputc(char c)
|
Inserts character c.
|
int_type sputn(const char* s,
streamsize n)
|
Inserts n characters at the position pointed to by the amount specified by s.
|
char* eback() const
|
Reads the start pointer of the input stream.
|
char* gptr() const
|
Reads the next pointer of the input stream.
|
char* egptr() const
|
Reads the end pointer of the input stream.
|
void gbump(int n)
|
Moves the next pointer of the input stream by the amount specified by n.
|
void setg(
char* gbeg,
char* gnext,
char* gend)
|
Assigns each pointer of the input stream.
|
char* pbase() const
|
Calculates the start pointer of the output stream.
|
char* pptr() const
|
Calculates the next pointer of the output stream.
|
char* epptr() const
|
Calculates the end pointer of the output stream.
|
void pbump(int n)
|
Moves the next pointer of the output stream by the amount specified by n.
|
void setp(char* pbeg, char* pend)
|
Assigns each pointer of the output stream.
|
virtual streambuf* setbuf(char* s,
streamsize n)*1
|
For each derived class, a defined operation is executed.
|
virtual pos_type seekoff(
off_type off,
ios_base::seekdir way,
ios_base::openmode = (ios_base::openmode)
(ios_base::in | ios_base::out))*1
|
Changes the stream position.
|
virtual pos_type seekpos(
pos_type sp,
ios_base::openmode = (ios_base::openmode)
(ios_base::in | ios_base::out))*1
|
Changes the stream position.
|
virtual int sync()*1
|
Flushes the output stream.
|
virtual int showmanyc()*1
|
Calculates the number of valid characters in the input stream.
|
virtual streamsize xsgetn(char* s, streamsize n)
|
Sets n characters in the memory area specified by s.
|
Function
|
virtual int_type underflow()*1
|
Reads one character without moving the stream position.
|
virtual int_type uflow()*1
|
Reads one character of the next pointer.
|
virtual int_type pbackfail(int type c = eof)*1
|
Puts back the character specified by c.
|
virtual streamsize xsputn(const char* s,
streamsize n)
|
Inserts n characters in the position specified by s.
|
virtual int_type overflow(int type c = eof)*1
|
Inserts character c in the output stream.
|
Note | This class does not define the processing. |
char* streambuf::_ec2p_getflag() const
|
References the pointer for the file input/output control flag.
char*& streambuf::_ec2p_gnptr()
|
References the pointer to the next position of the buffer from which data is to be read.
char*& streambuf::_ec2p_pnptr()
|
References the pointer to the next position of the buffer where data is to be written.
void streambuf::_ec2p_bcntplus()
|
Increments the valid data length of the buffer.
void streambuf::_ec2p_bcntminus()
|
Decrements the valid data length of the buffer.
void _ec2p_setbPtr(char** begptr, char** curptr, long* cntptr, long* lenptr, char* flgptr)
|
Sets the pointers of streambuf.
Constructor.
The initial settings are as follows:
_B_cnt_ptr = B_beg_ptr = B_next_ptr = B_end_ptr = C_flg_ptr = _B_len_ptr = 0
B_beg_pptr = &B_beg_ptr
B_next_pptr = &B_next_ptr
virtual streambuf::~streambuf()
|
Destructor.
streambuf* streambuf::pubsetbuf(char* s, streamsize n)
|
Allocates the buffer for stream input/output.
This function calls setbuf (s,n).
Return value: *this
pos_type streambuf::pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which =
(ios_base::openmode)(ios_base::in | ios_base::out))
|
Moves the read or write position for the input/output stream by using the method specified by way.
This function calls seekoff(off,way,which).
Return value: The stream position newly specified.
pos_type streambuf::pubseekpos(pos_type sp, ios_base::openmode which = (ios_base::openmode)(ios_base::in | ios_base::out))
|
Calculates the offset from the beginning of the stream to the current position.
Moves the current stream pointer by the amount specified by sp.
This function calls seekpos(sp,which).
Return value: The offset from the beginning of the stream.
Flushes the output stream.
This function calls sync().
Return value: 0
streamsize streambuf::in_avail()
|
Calculates the offset from the end of the input stream to the current position.
Return value:
If the position where data is read is valid: The offset from the end of the stream to the current position.
If the position where data is read is invalid: 0 (showmanyc() is called).
int_type streambuf::snextc()
|
Reads one character. If the character read is not eof, the next character is read.
Return value: If the character read is not eof: The character read
If the character read is eof: eof
int_type streambuf::sbumpc()
|
Reads one character and moves forward the pointer to the next.
Return value: If the position where data is read is valid: The character read
If the position where data is read is invalid: eof
int_type streambuf::sgetc()
|
Reads one character.
Return value: If the position where data is read is valid: The character read
If the position where data is read is invalid: eof
int streambuf::sgetn(char* s, streamsize n)
|
Sets n characters in the memory area specified by s. If an eof is found in the string read, setting is stopped.
Return value: The specified number of characters.
int_type streambuf::sputbackc(char c)
|
If the data read position is correct and the put back data of the position is the same as c, the read position is put back.
Return value: If the read position was put back: The value of c
If the read position was not put back: eof
If the data read position is correct, the read position is put back.
Return value: If the read position was put back: The value that was put back
If the read position was not put back: eof
int streambuf::sputc(char c)
|
Inserts character c.
Return value: If the write position is correct: The value of c
If the write position is incorrect: eof
int_type streambuf::sputn(const char* s, streamsize n)
|
Inserts n characters at the position specified by s.
If the buffer is smaller than n, the number of characters for the buffer is inserted.
Return value: The number of characters inserted.
char* streambuf::eback() const
|
Calculates the start pointer of the input stream.
Return value: Start pointer.
char* streambuf::gptr() const
|
Calculates the next pointer of the input stream.
Return value: Next pointer.
char* streambuf::egptr() const
|
Calculates the end pointer of the input stream.
Return value: End pointer.
void streambuf::gbump(int n)
|
Moves forward the next pointer of the input stream by the amount specified by n.
void streambuf::setg(char* gbeg, char* gnext, char* gend)
|
Sets each pointer of the input stream as follows:
*B_beg_pptr = gbeg;
*B_next_pptr = gnext;
B_end_ptr = gend;
*_B_cnt_ptr = gend-gnext;
*_B_len_ptr = gend-gbeg;
char* streambuf::pbase() const
|
Calculates the start pointer of the output stream.
Return value: Start pointer.
char* streambuf::pptr() const
|
Calculates the next pointer of the output stream.
Return value: Next pointer.
char* streambuf::epptr() const
|
Calculates the end pointer of the output stream.
Return value: End pointer.
void streambuf::pbump(int n)
|
Moves forward the next pointer of the output stream by the amount specified by n.
void streambuf::setp(char* pbeg, char* pend)
|
The settings for each pointer of the output stream are as follows:
*B_beg_pptr = pbeg;
*B_next_pptr = pbeg;
B_end_ptr = pend;
*_B_cnt_ptr = pend-pbeg;
*_B_len_ptr = pend-pbeg;
virtual streambuf* streambuf::setbuf(char* s, streamsize n)
|
For each derived class from streambuf, a defined operation is executed.
Return value: *this (This class does not define the processing.)
virtual pos_type streambuf::seekoff(off_type off, ios_base::seekdir way, ios_base::openmode =
(ios_base::openmode)(ios_base::in | ios_base::out))
|
Changes the stream position.
Return value: -1 (This class does not define the processing.)
virtual pos_type streambuf::seekpos(pos_type sp, ios_base::openmode = (ios_base::openmode)(ios_base::in | ios_base::out))
|
Changes the stream position.
Return value: -1 (This class does not define the processing.)
virtual int streambuf::sync()
|
Flushes the output stream.
Return value: 0 (This class does not define the processing.)
virtual int streambuf::showmanyc()
|
Calculates the number of valid characters in the input stream.
Return value: 0 (This class does not define the processing.)
virtual streamsize streambuf::xsgetn(char* s, streamsize n)
|
Sets n characters in the memory area specified by s.
If the buffer is smaller than n, the number of characters for the buffer is inserted.
Return value: The number of characters input.
virtual int_type streambuf::underflow()
|
Reads one character without moving the stream position.
Return value: eof (This class does not define the processing.)
virtual int_type streambuf::uflow()
|
Reads one character of the next pointer.
Return value: eof (This class does not define the processing.)
virtual int_type streambuf::pbackfail(int_type c = eof)
|
Puts back the character specified by c.
Return value: eof (This class does not define the processing.)
virtual streamsize streambuf::xsputn(const char* s, streamsize n)
|
Inserts n characters specified by s in to the stream position.
If the buffer is smaller than n, the number of characters for the buffer is inserted.
Return value: The number of characters inserted.
virtual int_type streambuf::overflow(int_type c = eof)
|
Inserts character c in the output stream.
Return value: eof (This class does not define the processing.)
|
|
|
Variable
|
ok_
|
Whether the current state is input-enabled.
|
Function
|
sentry(istream& is, bool noskipws = false)
|
Constructor.
|
~sentry()
|
Destructor.
|
operator bool()
|
References ok_.
|
istream::sentry::sentry(istream& is, bool noskipws = _false)
|
Constructor of internal class sentry.
If good() is non-zero, enables input with or without a format.
If tie() is non-zero, flushes the related output stream.
istream::sentry::~sentry()
|
Destructor of internal class sentry.
istream::sentry::operator bool()
|
References ok_.
Return value: ok_
|
|
|
Variable
|
chcount
|
The number of characters extracted by the input function called last.
|
Function
|
int _ec2p_getistr(char* str, unsigned int dig, int mode)
|
Converts str with the radix specified by dig.
|
istream(streambuf* sb)
|
Constructor.
|
virtual ~istream()
|
Destructor.
|
istream& operator>>(bool& n)
|
Stores the extracted characters in n.
|
istream& operator>>(short& n)
|
istream& operator>>(unsigned short& n)
|
istream& operator>>(int& n)
|
istream& operator>>(unsigned int& n)
|
istream& operator>>(long& n)
|
istream& operator>>(unsigned long& n)
|
istream& operator>>(long long& n)
|
istream& operator>>(unsigned long long& n)
|
istream& operator>>(float& n)
|
istream& operator>>(double& n)
|
istream& operator>>(long double& n)
|
istream& operator>>(void*& p)
|
Converts the extracted characters to a pointer to void and stores them in p.
|
istream& operator >>(streambuf* sb)
|
Extracts characters and stores them in the memory area specified by sb.
|
streamsize gcount() const
|
Calculates chcount (number of characters extracted).
|
int_type get()
|
Extracts a character
|
istream& get(char& c)
|
Extracts characters and stores them in c.
|
istream& get(signed char& c)
|
istream& get(unsigned char& c)
|
istream& get(char* s, streamsize n)
|
Extracts strings with size n-1 and stores them in the memory area specified by s.
|
istream& get(signed char* s, streamsize n)
|
istream& get(unsigned char* s, streamsize n)
|
Function
|
istream& get(char* s, streamsize n, char delim)
|
Extracts strings with size n-1 and stores them in the memory area specified by s. If delim is found in the string, input is stopped.
|
istream& get(
signed char* s,
streamsize n,
char delim)
|
istream& get(
unsigned char* s,
streamsize n,
char delim)
|
istream& get(streambuf& sb)
|
Extracts strings and stores them in the memory area specified by sb.
|
istream& get(streambuf& sb, char delim)
|
Extracts strings and stores them in the memory area specified by sb. If delim is found in the string, input is stopped.
|
istream& getline(char* s, streamsize n)
|
Extracts strings with size n-1 and stores them in the memory area specified by s.
|
istream& getline(signed char* s, streamsize n)
|
istream& getline(unsigned char* s, streamsize n)
|
istream& getline(char* s, streamsize n, char delim)
|
Extracts strings with size n-1 and stores them in the memory area specified by s. If delim is found in the string, input is stopped.
|
istream& getline(
signed char* s,
streamsize n,
char delim)
|
istream& getline(
unsigned char* s,
streamsize n,
char delim)
|
istream& ignore(
streamsize n = 1,
int_type delim = streambuf::eof)
|
Skips reading the number of characters specified by n. If delim is found in the string, skipping is stopped.
|
int_type peek()
|
Seeks for input characters that can be acquired next.
|
istream& read(char* s, streamsize n)
|
Extracts strings with size n and stores them in the memory area specified by s.
|
istream& read(signed char* s, streamsize n)
|
istream& read(unsigned char* s, streamsize n)
|
streamsize readsome(char* s, streamsize n)
|
Extracts strings with size n and stores them in the memory area specified by s.
|
streamsize readsome(signed char* s, streamsize n)
|
streamsize readsome(
unsigned char* s,
streamsize n)
|
Function
|
istream& putback(char c)
|
Puts back a character to the input stream.
|
istream& unget()
|
Puts back the position of the input stream.
|
int sync()
|
Checks the existence of the input stream.
This function calls streambuf::pubsync().
|
pos_type tellg()
|
Finds the input stream position.
This function calls streambuf::pubseekoff(0,cur,in).
|
istream& seekg(pos_type pos)
|
Moves the current stream pointer by the amount specified by pos.
This function calls streambuf::pubseekpos(pos).
|
istream& seekg(off_type off, ios_base::seekdir dir)
|
Moves the position to read the input stream by using the method specified by dir.
This function calls streambuf::pubseekoff(off,dir).
|
int istream::_ec2p_getistr(char* str, unsigned int dig, int mode)
|
Converts str to the radix specified by dig.
Return value: The converted radix.
istream::istream(streambuf* sb)
|
Constructor of class istream.
Calls ios::init(sb).
Specifies chcount=0.
virtual istream::~istream()
|
Destructor of class istream.
istream& istream::operator>>(bool& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(short& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(unsigned short& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(int& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(unsigned int& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(long& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(unsigned long& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(long long& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(unsigned long long& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(float& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(double& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(long double& n)
|
Stores the extracted characters in n.
Return value: *this
istream& istream::operator>>(void*& p)
|
Converts the extracted characters to a void* type and stores them in the memory specified by p.
Return value: *this
istream& istream::operator>>(streambuf* sb)
|
Extracts characters and stores them in the memory area specified by sb.
If there are no extracted characters, setstate(failbit) is called.
Return value: *this
streamsize istream::gcount() const
|
References chcount (number of extracted characters).
Return value: chcount
Extracts characters.
Return value: If characters are extracted: Extracted characters.
If no characters are extracted: Calls setstate(failbit) and becomes streambuf::eof.
istream& istream::get(char& c)
|
Extracts characters and stores them in c. If the extracted character is streambuf::eof, failbit is set.
Return value: *this
istream& istream::get(signed char& c)
|
Extracts characters and stores them in c. If the extracted character is streambuf::eof, failbit is set.
Return value: *this
istream& istream::get(unsigned char& c)
|
Extracts characters and stores them in c. If the extracted character is streambuf::eof, failbit is set.
Return value: *this
istream& istream::get(char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s. If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(signed char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s. If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(unsigned char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s. If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If delim is found in the string, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(signed char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If delim is found in the string, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(unsigned char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If delim is found in the string, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(streambuf& sb)
|
Extracts a string and stores it in the memory area specified by sb.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::get(streambuf& sb, char delim)
|
Extracts a string and stores it in the memory area specified by sb.
If delim is found in the string, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(signed char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(unsigned char* s, streamsize n)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If character delim is found, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(signed char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If character delim is found, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::getline(unsigned char* s, streamsize n, char delim)
|
Extracts a string with size n-1 and stores it in the memory area specified by s.
If character delim is found, input is stopped.
If ok_==false or no character has been extracted, failbit is set.
Return value: *this
istream& istream::ignore(streamsize n = 1, int_type delim = streambuf::eof)
|
Skips reading the number of characters specified by n.
If character delim is found, skipping is stopped.
Return value: *this
Seeks input characters that will be available next.
Return value: If ok_==false: streambuf::eof
If ok_!=false: rdbuf()->sgetc()
istream& istream::read(char* s, streamsize n)
|
If ok_!=false, extracts a string with size n and stores it in the memory area specified by s. If the number of extracted characters does not match with the number of n, eofbit is set.
Return value: *this
istream& istream::read(signed char* s, streamsize n)
|
If ok_!=false, extracts a string with size n and stores it in the memory area specified by s. If the number of extracted characters does not match with the number of n, eofbit is set.
Return value: *this
istream& istream::read(unsigned char* s, streamsize n)
|
If ok_!=false, extracts a string with size n and stores it in the memory area specified by s. If the number of extracted characters does not match with the number of n, eofbit is set.
Return value: *this
streamsize istream::readsome(char* s, streamsize n)
|
Extracts a string with size n and stores it in the memory area specified by s.
If the number of characters exceeds the stream size, only the number of characters equal to the stream size is stored.
Return value: The number of extracted characters.
streamsize istream::readsome(signed char* s, streamsize n)
|
Extracts a string with size n and stores it in the memory area specified by s.
If the number of characters exceeds the stream size, only the number of characters equal to the stream size is stored.
Return value: The number of extracted characters.
streamsize istream::readsome(unsigned char* s, streamsize n)
|
Extracts a string with size n and stores it in the memory area specified by s.
If the number of characters exceeds the stream size, only the number of characters equal to the stream size is stored.
Return value: The number of extracted characters.
istream& istream::putback(char c)
|
Puts back character c to the input stream.
If the characters put back are streambuf::eof, badbit is set.
Return value: *this
istream& istream::unget()
|
Puts back the pointer of the input stream by one.
If the extracted characters are streambuf::eof, badbit is set.
Return value: *this
Checks for an input stream.
This function calls streambuf::pubsync().
Return value: If there is no input stream: streambuf::eof
If there is an input stream: 0
pos_type istream::tellg()
|
Checks for the position of the input stream.
This function calls streambuf::pubseekoff(0,cur,in).
Return value: Offset from the beginning of the stream
If an error occurs during the input processing, -1 is returned.
istream& istream::seekg(pos_type pos)
|
Moves the current stream pointer by the amount specified by pos.
This function calls streambuf::pubseekpos(pos).
Return value: *this
istream& istream::seekg(off_type off, ios_base::seekdir dir)
|
Moves the position to read the input stream using the method specified by dir.
This function calls streambuf::pubseekoff(off,dir). If an error occurs during the input processing, this processing is not performed.
Return value: *this
(h) | istream Class Manipulator |
|
|
|
Function
|
istream& ws(istream& is)
|
Skips reading the spaces.
|
Skips reading white spaces.
Return value: is
(i) | istream Non-Member Function |
|
|
|
Function
|
istream& operator>>(istream& in, char* s)
|
Extracts a string and stores it in the memory area specified by s.
|
istream& operator>>(istream& in, signed char* s)
|
istream& operator>>(istream& in, unsigned char* s)
|
istream& operator>>(istream& in, char& c)
|
Extracts a character and stores it in c.
|
istream& operator>>(istream& in, signed char& c)
|
istream& operator>>(istream& in, unsigned char& c)
|
istream& operator>>(istream& in, char* s)
|
Extracts a string and stores it in the memory area specified by s.
Processing is stopped if
the number of characters stored is equal to field width – 1
streambuf::eof is found in the input stream
the next available character c satisfies isspace(c)==1
If no characters are stored, failbit is set.
Return value: in
istream& operator>>(istream& in, signed char* s)
|
Extracts a string and stores it in the memory area specified by s.
Processing is stopped if
the number of characters stored is equal to field width – 1
streambuf::eof is found in the input stream
the next available character c satisfies isspace(c)==1
If no characters are stored, failbit is set.
Return value: in
istream& operator>>(istream& in, unsigned char* s)
|
Extracts a string and stores it in the memory area specified by s.
Processing is stopped if
the number of characters stored is equal to field width – 1
streambuf::eof is found in the input stream
the next available character c satisfies isspace(c)==1
If no characters are stored, failbit is set.
Return value: in
istream& operator>>(istream& in, char& c)
|
Extracts a character and stores it in c. If no character is stored, failbit is set.
Return value: in
istream& operator>>(istream& in, signed char& c)
|
Extracts a character and stores it in c. If no character is stored, failbit is set.
Return value: in
istream& operator>>(istream& in, unsigned char& c)
|
Extracts a character and stores it in c. If no character is stored, failbit is set.
Return value: in
|
|
|
Variable
|
ok_
|
Whether or not the current state allows output.
|
_ _ec2p_os
|
Pointer to the ostream object.
|
Function
|
sentry(ostream& os)
|
Constructor.
|
~sentry()
|
Destructor.
|
operator bool()
|
References ok_.
|
ostream::sentry::sentry(ostream& os)
|
Constructor of the internal class sentry.
If good() is non-zero and tie() is non-zero, flush() is called.
Specifies os to _ _ec2p_os.
ostream::sentry::~sentry()
|
Destructor of internal class sentry.
If (_ _ec2p_os->flags() & ios_base::unitbuf) is true, flush() is called.
ostream::sentry::operator bool()
|
References ok_.
Return value: ok_
|
|
|
Function
|
ostream(streambuf* sbptr)
|
Constructor.
|
virtual ~ostream()
|
Destructor.
|
Function
|
ostream& operator<<(bool n)
|
Inserts n in the output stream.
|
ostream& operator<<(short n)
|
ostream& operator<<(unsigned short n)
|
ostream& operator<<(int n)
|
ostream& operator<<(unsigned int n)
|
ostream& operator<<(long n)
|
ostream& operator<<(unsigned long n)
|
ostream& operator<<(long long n)
|
ostream& operator<<(unsigned long long n)
|
ostream& operator<<(float n)
|
ostream& operator<<(double n)
|
ostream& operator<<(long double n)
|
ostream& operator<<(void* n)
|
ostream& operator<<(streambuf* sbptr)
|
Inserts the output string of sbptr into the output stream.
|
ostream& put(char c)
|
Inserts character c into the output stream.
|
ostream& write(
const char* s,
streamsize n)
|
Inserts n characters from s into the output stream.
|
ostream& write(
const signed char* s,
streamsize n)
|
ostream& write(
const unsigned char* s,
streamsize n)
|
ostream& flush()
|
Flushes the output stream.
This function calls streambuf::pubsync().
|
pos_type tellp()
|
Calculates the current write position.
This function calls streambuf::pubseekoff(0,cur,out).
|
ostream& seekp(pos_type pos)
|
Calculates the offset from the beginning of the stream to the current position.
Moves the current stream pointer by the amount specified by pos.
This function calls streambuf::pubseekpos(pos).
|
ostream& seekp(off_type off, seekdir dir)
|
Moves the stream write position by the amount specified by off, from dir.
This function calls streambuf::pubseekoff(off,dir).
|
ostream::ostream(streambuf* sbptr)
|
Constructor.
Calls ios(sbptr).
virtual ostream::~ostream()
|
Destructor.
ostream& ostream::operator<<(bool n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(short n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(unsigned short n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(int n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(unsigned int n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(long n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(unsigned long n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(long long n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(unsigned long long n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(float n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(double n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(long double n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(void* n)
|
If sentry::ok_==true, n is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::operator<<(streambuf* sbptr)
|
If sentry::ok_==true, the output string of sbptr is inserted into the output stream.
If sentry::ok_==false, failbit is set.
Return value: *this
ostream& ostream::put(char c)
|
If (sentry::ok_==true) and (rdbuf()->sputc(c)!=streambuf::eof), c is inserted into the output stream.
Otherwise badbit is set.
Return value: *this
ostream& ostream::write(const char* s, streamsize n)
|
If (sentry::ok_==true) and (rdbuf()->sputn(s, n)==n), n characters specified by s are inserted into the output stream.
Otherwise badbit is set.
Return value: *this
ostream& ostream::write(const signed char* s, streamsize n)
|
If (sentry::ok_==true) and (rdbuf()->sputn(s, n)==n), n characters specified by s are inserted into the output stream.
Otherwise badbit is set.
Return value: *this
ostream& ostream::write(const unsigned char* s, streamsize n)
|
If (sentry::ok_==true) and (rdbuf()->sputn(s, n)==n), n characters specified by s are inserted into the output stream.
Otherwise badbit is set.
Return value: *this
ostream& ostream::flush()
|
Flushes the output stream.
This function calls streambuf::pubsync().
Return value: *this
pos_type ostream::tellp()
|
Calculates the current write position.
This function calls streambuf::pubseekoff(0,cur,out).
Return value: The current stream position
If an error occurs during processing, -1 is returned.
ostream& ostream::seekp(pos_type pos)
|
If no error occurs, the offset from the beginning of the stream to the current position is calculated.
Moves the current stream pointer by the amount specified by pos.
This function calls streambuf::pubseekpos(pos).
Return value: *this
ostream& ostream::seekp(off_type off, seekdir dir)
|
If no error occurs, the stream write position is moved by the amount specified by off, from dir.
This function calls streambuf::pubseekoff(off,dir).
Return value: *this
(l) | ostream Class Manipulator |
|
|
|
Function
|
ostream& endl(ostream& os)
|
Inserts a new line and flushes the output stream.
|
ostream& ends(ostream& os)
|
Inserts a NULL code.
|
ostream& flush(ostream& os)
|
Flushes the output stream.
|
ostream& endl(ostream& os)
|
Inserts a new line code and flushes the output stream.
This function calls flush().
Return value: os
ostream& ends(ostream& os)
|
Inserts a NULL code into the output line.
Return value: os
ostream& flush(ostream& os)
|
Flushes the output stream.
This function calls streambuf::sync().
Return value: os
(m) | ostream Non-Member Function |
|
|
|
Function
|
ostream& operator<<(ostream& os, char s)
|
Inserts s into the output stream.
|
ostream& operator<<(ostream& os, signed char s)
|
ostream& operator<<(ostream& os, unsigned char s)
|
ostream& operator<<(ostream& os, const char* s)
|
ostream& operator<<(ostream& os, const signed char* s)
|
ostream& operator<<(ostream& os, const unsigned char* s)
|
ostream& operator<<(ostream& os, char s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
ostream& operator<<(ostream& os, signed char s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
ostream& operator<<(ostream& os, unsigned char s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
ostream& operator<<(ostream& os, const char* s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
ostream& operator<<(ostream& os, const signed char* s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
ostream& operator<<(ostream& os, const unsigned char* s)
|
If (sentry::ok_==true) and an error does not occur, s is inserted into the output stream. Otherwise failbit is set.
Return value: os
(n) | smanip Class Manipulator |
|
|
|
Function
|
smanip resetiosflags(ios_base::fmtflags mask)
|
Clears the flag specified by the mask value.
|
smanip setiosflags(ios_base::fmtflags mask)
|
Specifies the format flag (fmtfl).
|
smanip setbase(int base)
|
Specifies the radix used at output.
|
smanip setfill(char c)
|
Specifies the fill character (fillch).
|
smanip setprecision(int n)
|
Specifies the precision (prec).
|
smanip setw(int n)
|
Specifies the field width (wide).
|
smanip resetiosflags(ios_base::fmtflags mask)
|
Clears the flag specified by the mask value.
Return value: Target object of input/output.
smanip setiosflags(ios_base::fmtflags mask)
|
Specifies the format flag (fmtfl).
Return value: Target object of input/output.
Specifies the radix used at output.
Return value: Target object of input/output.
Specifies the fill character (fillch).
Return value: Target object of input/output.
smanip setprecision(int n)
|
Specifies the precision (prec).
Return value: Target object of input/output.
Specifies the field width (wide).
Return value: Target object of input/output.
(o) | Example of Using EC++ Input/Output Libraries |
The input/output stream can be used if a pointer to an object of the mystrbuf class is used instead of streambuf at the initialization of the istream and ostream objects.
The following shows the inheritance relationship of the above classes. An arrow (->) indicates that a derived class references a base class.
|
|
|
Variable
|
_file_Ptr
|
File pointer.
|
Function
|
mystrbuf()
|
Constructor.
Initializes the streambuf buffer.
|
mystrbuf(void* ptr)
|
virtual ~mystrbuf()
|
Destructor.
|
void* myfptr() const
|
Returns a pointer to the FILE type structure.
|
mystrbuf* open(const char* filename,
int mode)
|
Specifies the file name and mode, and opens the file.
|
mystrbuf* close()
|
Closes the file.
|
virtual streambuf* setbuf(char* s,
streamsize n)
|
Allocates the stream input/output buffer.
|
virtual pos_type seekoff(
off_type off,
ios_base::seekdir way,
ios_base::openmode =
(ios_base::openmode)
(ios_base::in | ios_base::out))
|
Changes the position of the stream pointer.
|
virtual pos_type seekpos(
pos_type sp,
ios_base::openmode =
(ios_base::openmode)
(ios_base::in | ios_base::out))
|
Changes the position of the stream pointer.
|
virtual int sync()
|
Flushes the stream.
|
virtual int showmanyc()
|
Returns the number of valid characters in the input stream.
|
virtual int_type underflow()
|
Reads one character without moving the stream position.
|
virtual int_type pbackfail(int type c =
streambuf::eof)
|
Puts back the character specified by c.
|
virtual int_type overflow(int type c =
streambuf::eof)
|
Inserts the character specified by c.
|
void _Init(_f_type* fp)
|
Initialization.
|
<Example>
#include <istream>
#include <ostream>
#include <mystrbuf>
#include <string>
#include <new>
#include <stdio.h>
void main(void)
{
mystrbuf myfin(stdin);
mystrbuf myfout(stdout);
istream mycin(&myfin);
ostream mycout(&myfout);
int i;
short s;
long l;
char c;
string str;
mycin >> i >> s >> l >> c >> str;
mycout << "This is EC++ Library." << endl << i << s << l << c << str << endl;
return;
}
|