📄 ios_.gml
字号:
:MONO.ios::noreplace
is specified if the file must not exist before it is opened. That is,
the file must be a new file. If the file exists, an error occurs.
:P.
:MONO.ios::text
is specified if the file is to be treated as a
:ITALICS.text
file. A text file is divided into records, and each record is terminated by a
:ITALICS.new-line
character, usually represented as
:MONO.'\n'.
The new-line character is translated into a form that is compatible
with the underlying file system's concept of text files.
This conversion happens automatically whenever the new-line is written
to the file, and the inverse conversion (to the new-line character)
happens automatically whenever the end of a record is read from the
file system.
:P.
:MONO.ios::binary
is specified if the file is to be treated as a
:ITALICS.binary
file. Binary files are streams of characters.
No character has a special meaning.
No grouping of characters into records is apparent to the program,
although the underlying file system may cause such a grouping to occur.
:P.
The following default behaviors are defined:
:P.
If
:MONO.ios::out
is specified and none of
:MONO.ios::in
:CONT.,
:MONO.ios::append
or
:MONO.ios::atend
are specified,
:MONO.ios::truncate
is assumed.
:P.
If
:MONO.ios::append
is specified,
:MONO.ios::out
is assumed.
:P.
If
:MONO.ios::truncate
is specified,
:MONO.ios::out
is assumed.
:P.
If neither
:MONO.ios::text
nor
:MONO.ios::binary
is specified,
:MONO.ios::text
is assumed.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.operator !
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='operator !'.int ios::operator !() const;
:eSNPL.
:SMTICS.
The &fn. tests the &errstate. of the &obj.:PERIOD.
:RSLTS.
The &fn. returns a non-zero value if either of &failbit. or &badbit. bits
are set in the &errstate., otherwise zero is returned.
:SALSO.
:SAL typ='mfun'.bad
:SAL typ='mfun'.clear
:SAL typ='mfun'.fail
:SAL typ='mfun'.good
:SAL typ='mtyp'.iostate
:SAL typ='mfun'.operator~bvoid~b*
:SAL typ='mfun'.rdstate
:SAL typ='mfun'.setstate
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.operator void *
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='operator void *'.ios::operator void *() const;
:eSNPL.
:SMTICS.
The &fn. converts the &obj. into a pointer to
:MONO.void
:PERIOD.
The actual pointer value returned is meaningless and intended only for
comparison with &null. to determine the &errstate. of the &obj.:PERIOD.
:RSLTS.
The &fn. returns a &null. pointer
if either of &failbit. or &badbit. bits are set in the
&errstate., otherwise a non-&null. pointer is returned.
:SALSO.
:SAL typ='mfun'.bad
:SAL typ='mfun'.clear
:SAL typ='mfun'.fail
:SAL typ='mfun'.good
:SAL typ='mtyp'.iostate
:SAL typ='mfun'.operator~b!
:SAL typ='mfun'.rdstate
:SAL typ='mfun'.setstate
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.precision
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='precision'.int ios::precision() const;
:SNPF index='precision'.int ios::precision( int prec );
:eSNPL.
:SMTICS.
The &fn. is used to query and/or set the &fmtprec.:PERIOD.
:I1.format precision
The &fmtprec. is used to control the number of digits of precision used when
formatting floating-point numbers. For scientific notation, the
&fmtprec. describes the total number of
digits before and after the decimal point, but not including the
exponent.
For fixed-point notation, the &fmtprec. describes the number of digits
after the decimal point.
:P.
The first form of the &fn. looks up the current &fmtprec.:PERIOD.
:P.
The second form of the &fn. sets the &fmtprec. to
:ARG.prec
:PERIOD.
:P.
By default, the &fmtprec. is six. If
:ARG.prec
is specified to be less than zero, the &fmtprec. is set to six.
Otherwise, the specified &fmtprec. is used. For scientific notation, a
&fmtprec. of zero is treated as a precision of one.
:RSLTS.
The &fn. returns the previous &fmtprec. setting.
:SALSO.
:SAL typ='mtyp'.fmtflags
:SAL typ='mnp'.setprec
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.pword
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='pword'.void * &.ios::pword( int index );
:eSNPL.
:SMTICS.
The &fn. creates a reference to a
:MONO.void
pointer, which may be used to store and retrieve any suitable pointer value.
The
:ARG.index
parameter specifies which
:MONO.void
pointer is to be referenced and must be obtained from a call to the
:MONO.xalloc
static member function.
:INCLUDE file='ipword'.
:RSLTS.
The &fn. returns a reference to a
:MONO.void
pointer.
:SALSO.
:SAL typ='mfun'.iword
:SAL typ='mfun'.xalloc
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.rdbuf
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='rdbuf'.streambuf *ios::rdbuf() const;
:eSNPL.
:SMTICS.
The &fn. looks up the pointer to the
:MONO.streambuf
object which maintains the buffer associated with the &obj.:PERIOD.
:RSLTS.
The &fn. returns the pointer to the
:MONO.streambuf
object associated with the &obj.:PERIOD.
If there is no associated
:MONO.streambuf
object, &null. is returned.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.rdstate
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='rdstate'.iostate ios::rdstate() const;
:eSNPL.
:SMTICS.
The &fn. is used to query the current value of &iostate. in the &obj.
without modifying it.
:RSLTS.
The &fn. returns the current value of &iostate.:PERIOD.
:SALSO.
:SAL typ='mfun'.bad
:SAL typ='mfun'.clear
:SAL typ='mfun'.eof
:SAL typ='mfun'.fail
:SAL typ='mfun'.good
:SAL typ='mtyp'.iostate
:SAL typ='mfun'.operator~b!
:SAL typ='mfun'.operator~bvoid~b*
:SAL typ='mfun'.setstate
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mtyp' prot='public'.seekdir
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPFLF .enum seek_dir {
:SNPT index='beg' . beg, // seek from beginning
:SNPT index='cur' . cur, // seek from current position
:SNPT index='end' . end // seek from end
:SNPFLF .};
:SNPT index='seekdir'.typedef int seekdir;
:eSNPL.
:SMTICS.
The type
:MONO.ios::seek_dir
is a set of bits representing
different methods of seeking within a stream.
The &fn. represents the same set of bits, but uses an
:MONO.int
to represent the values, thereby avoiding problems made possible by the
compiler's ability to use smaller types for enumerations.
All uses of these bits should use the &fn.:PERIOD.
:P.
The bit values defined by &fn. are used by the member functions
:MONO.seekg
and
:MONO.seekp
:CONT.,
as well the
:MONO.seekoff
and
:MONO.seekpos
member functions in classes derived from the
:MONO.streambuf
class.
:P.
:MONO.ios::beg
causes the seek offset to be interpreted as an offset from the beginning of
the stream. The offset is specified as a positive value.
:P.
:MONO.ios::cur
causes the seek offset to be interpreted as an offset from the current
position of the stream. If the offset is a negative value, the seek is
towards the start of the stream. Otherwise, the seek is towards the end of
the stream.
:P.
:MONO.ios::end
causes the seek offset to be interpreted as an offset from the end of the
stream. The offset is specified as a negative value.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.setf
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='setf'.ios::fmtflags ios::setf( ios::fmtflags onbits );
:SNPF index='setf'.ios::fmtflags ios::setf( ios::fmtflags setbits,
:SNPFLF . ios::fmtflags mask );
:eSNPL.
:SMTICS.
The &fn. is used to set bits in &fmtflags. in the &obj.:PERIOD.
:P.
The first form is used to turn on the bits that are on in the
:ARG.onbits
parameter. (
:CONT.:ARG.onbits
is or'ed into &fmtflags.).
:P.
The second form is used to turn off the bits specified in the
:ARG.mask
parameter and turn on the bits specified in the
:ARG.setbits
parameter.
This form is particularly useful for setting the bits described by the
:MONO.ios::basefield
:CONT.,
:MONO.ios::adjustfield
and
:MONO.ios::floatfield
values, where only one bit should be on at a time.
:RSLTS.
Both forms of the &fn. return the previous &fmtflags. value.
:SALSO.
:SAL typ='mtyp'.fmtflags
:SAL typ='mfun'.setf
:SAL typ='mfun'.unsetf
:SAL typ='mnp'.dec
:SAL typ='mnp'.hex
:SAL typ='mnp'.oct
:SAL typ='mnp'.setbase
:SAL typ='mnp'.setiosflags
:SAL typ='mnp'.resetiosflags
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='protected'.setstate
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .protected:
:SNPF index='setstate'.void ios::setstate( int or_bits );
:eSNPL.
:SMTICS.
The &fn. is provided as a convenience for classes derived from the &cls.:PERIOD.
It turns on the &errstate. bits that are set in the
:ARG.or_bits
parameter, and leaves the other &errstate. bits unchanged.
:RSLTS.
The &fn. sets the bits specified by
:ARG.or_bits
in the &errstate.:PERIOD.
:SALSO.
:SAL typ='mfun'.bad
:SAL typ='mfun'.clear
:SAL typ='mfun'.eof
:SAL typ='mfun'.fail
:SAL typ='mfun'.good
:SAL typ='mtyp'.iostate
:SAL typ='mfun'.operator~b!
:SAL typ='mfun'.operator~bvoid~b*
:SAL typ='mfun'.rdstate
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public static'.sync_with_stdio
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='sync_with_stdio'.static void ios::sync_with_stdio();
:eSNPL.
:SMTICS.
The &fn. is obsolete.
It is provided for compatibility.
:RSLTS.
The &fn. has no return value.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.tie
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='tie'.ostream *ios::tie() const;
:SNPF index='tie'.ostream *ios::tie( ostream *ostrm );
:eSNPL.
:SMTICS.
The &fn. is used to query and/or set up a connection between the &obj.
and another stream.
The connection causes the output stream specified by
:ARG.ostrm
to be flushed whenever the &obj. is about to read characters from a
device or is about to write characters to an output buffer or device.
:P.
The first form of the &fn. is used to query the current tie.
:P.
The second form of the &fn. is used to set the tied stream to
:ARG.ostrm
:PERIOD.
:P.
Normally, the predefined streams &cin. and &cerr. set up ties to &cout. so that
any input from the terminal flushes any buffered output, and any writes to
&cerr. flush &cout. before the characters are written. &cout. does not set
up a tie to &cerr. because &cerr. has the flag
:MONO.ios::unitbuf
set, so it flushes itself after every write operation.
:RSLTS.
Both forms of the &fn. return the previous tie value.
:SALSO.
:SAL typ='mtyp'.fmtflags
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.unsetf
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='unsetf'.ios::fmtflags ios::unsetf( ios::fmtflags offbits );
:eSNPL.
:SMTICS.
The &fn. is used to turn off bits in &fmtflags. that are set in the
:ARG.offbits
parameter. All other bits in &fmtflags. are unchanged.
:RSLTS.
The &fn. returns the old &fmtflags. value.
:SALSO.
:SAL typ='mtyp'.fmtflags
:SAL typ='mfun'.setf
:SAL typ='mfun'.unsetf
:SAL typ='mnp'.dec
:SAL typ='mnp'.hex
:SAL typ='mnp'.oct
:SAL typ='mnp'.setbase
:SAL typ='mnp'.setiosflags
:SAL typ='mnp'.resetiosflags
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.width
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='width'.int ios::width() const;
:SNPF index='width'.int ios::width( int wid );
:eSNPL.
:SMTICS.
The &fn. is used to query and/or set the &fmtwidth. used to format
:I1.format width
the next item. A &fmtwidth. of zero indicates that the item is to be written
using exactly the number of positions required. Other values indicate
that the item must occupy at least that many positions.
If the formatted item is larger than the specified &fmtwidth., the
&fmtwidth. is ignored and the item is formatted using the required number
of positions.
:P.
The first form of the &fn. is used to query the &fmtwidth. that is to be used
for the next item.
:P.
The second form of the &fn. is used to set the &fmtwidth. to
:ARG.wid
for the next item to be formatted.
:P.
After an item has been formatted, the &fmtwidth. is reset to zero.
Therefore, any non-zero &fmtwidth. must be set before each item that is
to be formatted.
:RSLTS.
The &fn. returns the previous &fmtwidth.:PERIOD.
:SALSO.
:SAL typ='mtyp'.fmtflags
:SAL typ='mnp'.setw
:SAL typ='mnp'.setwidth
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public static'.xalloc
:SNPL.
:SNPFLF .#include <iostream.h>
:SNPFLF .public:
:SNPF index='xalloc'.static int ios::xalloc();
:eSNPL.
:SMTICS.
The &fn. returns an index into an array of items that the program may
use for any purpose. Each item can be either a
:MONO.long int
or a pointer to
:MONO.void
:PERIOD.
The index can be used with the
:MONO.iword
and
:MONO.pword
member functions.
:INCLUDE file='ios_stat'.
:RSLTS.
The &fn. returns an index for use with the
:MONO.iword
and
:MONO.pword
member functions.
:SALSO.
:SAL typ='mfun'.iword
:SAL typ='mfun'.pword
:eSALSO.
:eLIBF.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -