📄 ios.html
字号:
<LI><CODE><A HREF="#basic_ios::rdstate">rdstate</A>()</CODE> returns<CODE><A HREF="#ios_base::goodbit">goodbit</A></CODE> if<CODE>strbuf</CODE> is nonzero; otherwise, it returns<CODE><A HREF="#ios_base::badbit">badbit</A></CODE></LI><LI><CODE><A HREF="#basic_ios::exceptions">exceptions</A>()</CODE> returns<CODE>goodbit</CODE></LI><LI><CODE><A HREF="#ios_base::flags">flags</A>()</CODE> returns<CODE><A HREF="#ios_base::skipws">skipws</A> |<A HREF="#ios_base::dec">dec</A></CODE></LI><LI><CODE><A HREF="#ios_base::width">width</A>()</CODE> returns zero</LI><LI><CODE><A HREF="#ios_base::precision">precision</A>()</CODE>returns 6</LI><LI><CODE><A HREF="#basic_ios::fill">fill</A>()</CODE> returns thespace character</LI><LI><CODE><A HREF="#ios_base::getloc">getloc</A>()</CODE> returns<CODE>locale::<A HREF="locale2.html#locale::classic">classic</A>()</CODE></LI><LI><CODE><A HREF="#ios_base::iword">iword</A></CODE> returns zero and<CODE><A HREF="#ios_base::pword">pword</A></CODE> returns a nullpointer for all argument value</LI></UL><H3><A NAME="basic_ios::int_type"><CODE>basic_ios::int_type</CODE></A></H3><PRE>typedef typename Ty::int_type <B>int_type</B>;</PRE><P>The type is a synonym for<CODE>Ty::<A HREF="string2.html#char_traits::int_type">int_type</A></CODE>.</P><H3><A NAME="basic_ios::narrow"><CODE>basic_ios::narrow</CODE></A></H3><PRE>char <B>narrow</B>(char_type ch, char dflt);</PRE><P>The member function returns<CODE><A HREF="locale2.html#use_facet">use_facet</A><<A HREF="locale2.html#ctype">ctype</A><Elem> >(<A HREF="ios.html#ios_base::getloc">getloc</A>()).<A HREF="locale2.html#ctype::narrow">narrow</A>(ch, dflt)</CODE>.</P><H3><A NAME="basic_ios::off_type"><CODE>basic_ios::off_type</CODE></A></H3><PRE>typedef typename Ty::off_type <B>off_type</B>;</PRE><P>The type is a synonym for<CODE>Ty::<A HREF="string2.html#char_traits::off_type">off_type</A></CODE>.</P><H3><A NAME="basic_ios::operator void *"><CODE>basic_ios::operator void *</CODE></A></H3><PRE><B>operator void *</B>() const;</PRE><P>The operator returns a null pointer only if<CODE><A HREF="#basic_ios::fail">fail</A>()</CODE>.</P><H3><A NAME="basic_ios::operator!"><CODE>basic_ios::operator!</CODE></A></H3><PRE>bool <B>operator!</B>() const;</PRE><P>The operator returns<CODE><A HREF="#basic_ios::fail">fail</A>()</CODE>.</P><H3><A NAME="basic_ios::pos_type"><CODE>basic_ios::pos_type</CODE></A></H3><PRE>typedef typename Ty::pos_type <B>pos_type</B>;</PRE><P>The type is a synonym for<CODE>Ty::<A HREF="string2.html#char_traits::pos_type">pos_type</A></CODE>.</P><H3><A NAME="basic_ios::rdbuf"><CODE>basic_ios::rdbuf</CODE></A></H3><PRE>basic_streambuf<Elem, Tr> *<B>rdbuf</B>() const;basic_streambuf<Elem, Tr> *<B>rdbuf</B>(basic_streambuf<Elem, Tr> *strbuf);</PRE><P>The first member function returns the stored<A HREF="#stream buffer pointer">stream buffer pointer</A>.</P><P>The second member function stores <CODE>strbuf</CODE> in the stored<A HREF="#stream buffer pointer">stream buffer pointer</A>and returns the previously stored value.</P><H3><A NAME="basic_ios::rdstate"><CODE>basic_ios::rdstate</CODE></A></H3><PRE>iostate <B>rdstate</B>() const;</PRE><P>The member function returns the stored<A HREF="#stream state information">stream state information</A>.</P><H3><A NAME="basic_ios::setstate"><CODE>basic_ios::setstate</CODE></A></H3><PRE>void <B>setstate</B>(iostate state);</PRE><P>The member function effectively calls<CODE><A HREF="#basic_ios::clear">clear</A>(state |<A HREF="#basic_ios::rdstate">rdstate</A>())</CODE>.</P><H3><A NAME="basic_ios::tie"><CODE>basic_ios::tie</CODE></A></H3><PRE>basic_ostream<Elem, Tr> *<B>tie</B>() const;basic_ostream<Elem, Tr> *<B>tie</B>(basic_ostream<Elem, Tr> *newtie);</PRE><P>The first member function returns the stored<A HREF="#tie pointer">tie pointer</A>. The second member functionstores <CODE>newtie</CODE> in the tie pointer and returns its previousstored value.</P><H3><A NAME="basic_ios::traits_type"><CODE>basic_ios::traits_type</CODE></A></H3><PRE>typedef Tr <B>traits_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Tr</CODE>.</P><H3><A NAME="basic_ios::widen"><CODE>basic_ios::widen</CODE></A></H3><PRE>char_type <B>widen</B>(char ch);</PRE><P>The member function returns<CODE><A HREF="locale2.html#use_facet">use_facet</A><<A HREF="locale2.html#ctype">ctype</A><Elem> >(<A HREF="ios.html#ios_base::getloc">getloc</A>()).<A HREF="locale2.html#ctype::widen">widen</A>(ch)</CODE>.<H2><A NAME="boolalpha"><CODE>boolalpha</CODE></A></H2><PRE>ios_base& <B>boolalpha</B>(ios_base& iosbase);</PRE><P>The manipulator effectively calls<CODE>iosbase.<A HREF="#ios_base::setf">setf</A>(ios_base::<A HREF="#ios_base::boolalpha">boolalpha</A>)</CODE>, then returns<CODE>iosbase</CODE>.</P><H2><A NAME="dec"><CODE>dec</CODE></A></H2><PRE>ios_base& <B>dec</B>(ios_base& iosbase);</PRE><P>The manipulator effectively calls<CODE>iosbase.<A HREF="#ios_base::setf">setf</A>(ios_base::<A HREF="#ios_base::dec">dec</A>, ios_base::<A HREF="#ios_base::basefield">basefield</A>)</CODE>, then returns<CODE>iosbase</CODE>.</P><H2><A NAME="fixed"><CODE>fixed</CODE></A></H2><PRE>ios_base& <B>fixed</B>(ios_base& iosbase);</PRE><P>The manipulator effectively calls<CODE>iosbase.<A HREF="#ios_base::setf">setf</A>(ios_base::<A HREF="#ios_base::fixed">fixed</A>, ios_base::<A HREF="#ios_base::floatfield">floatfield</A>)</CODE>, then returns<CODE>iosbase</CODE>.</P><H2><A NAME="fpos"><CODE>fpos</CODE></A></H2><PRE>template <class St> class <B>fpos</B> {public: <B><A HREF="#fpos::fpos">fpos</A></B>(streamoff off); <B><A HREF="#fpos::fpos">fpos</A></B>(St state, fpos_t filepos); St <B><A HREF="#fpos::state">state</A></B>() const; void <B><A HREF="#fpos::state">state</A></B>(St state); <B><A HREF="#fpos::operator streamoff">operator streamoff</A></B>() const; streamoff <B><A HREF="#fpos::operator-">operator-</A></B>(const fpos& right) const; fpos& <B><A HREF="#fpos::operator+=">operator+=</A></B>(streamoff off); fpos& <B><A HREF="#fpos::operator-=">operator-=</A></B>(streamoff off); fpos <B><A HREF="#fpos::operator+">operator+</A></B>(streamoff off) const; fpos <B><A HREF="#fpos::operator-">operator-</A></B>(streamoff off) const; bool <B><A HREF="#fpos::operator==">operator==</A></B>(const fpos& right) const; bool <B><A HREF="#fpos::operator!=">operator!=</A></B>(const fpos& right) const; };</PRE><P>The template class describes an objectthat can store all the information needed to restore an arbitrary<A HREF="lib_file.html#file-position indicator">file-position indicator</A>within any stream. An object of class <CODE>fpos<St></CODE> effectivelystores at least two member objects:</P><UL><LI>a byte offset, of type<CODE><A HREF="#streamoff">streamoff</A></CODE></LI><LI>a conversion state, for use by an object of class <CODE>basic_filebuf</CODE>,of type <B><CODE>St</CODE></B>, typically<CODE><A HREF="wchar.html#mbstate_t">mbstate_t</A></CODE></LI></UL><P>It can also store an arbitrary file position, for use by an object of class<CODE><A HREF="fstream.html#basic_filebuf">basic_filebuf</A></CODE>,of type <CODE><A HREF="stdio.html#fpos_t">fpos_t</A></CODE>.For an environment with limited file size, however,<CODE>streamoff</CODE> and <CODE>fpos_t</CODE> may sometimesbe used interchangeably. And for an environment with nostreams that have a<A HREF="charset.html#state-dependent encoding">state-dependent encoding</A>,<CODE>mbstate_t</CODE> may actually be unused. So the number ofmember objects stored may vary.</P><H3><A NAME="fpos::fpos"><CODE>fpos::fpos</CODE></A></H3><PRE><B>fpos</B>(streamoff off);<B>fpos</B>(St state, fpos_t filepos);</PRE><P>The first constructor stores the offset<CODE>off</CODE>,relative to the beginning of file and in the<A HREF="charset.html#initial conversion state">initial conversion state</A>(if that matters).If <CODE>off</CODE> is -1,the resulting object represents an invalid stream position.</P><P>The second constructor stores the object <CODE>state</CODE>and a file position determined by <CODE>filepos</CODE>.</P><H3><A NAME="fpos::operator!="><CODE>fpos::operator!=</CODE></A></H3><PRE>bool <B>operator!=</B>(const fpos& right) const;</PRE><P>The member function returns <CODE>!(*this == right)</CODE>.</P><H3><A NAME="fpos::operator+"><CODE>fpos::operator+</CODE></A></H3><PRE>fpos <B>operator+</B>(streamoff off) const;</PRE><P>The member function returns <CODE>fpos(*this) += off</CODE>.</P><H3><A NAME="fpos::operator+="><CODE>fpos::operator+=</CODE></A></H3><PRE>fpos& <B>operator+=</B>(streamoff off);</PRE><P>The member function adds <CODE>off</CODE> to the stored offset member object,then returns <CODE>*this</CODE>. For positioning within a file, theresult is generally valid only for<A HREF="lib_file.html#binary stream">binary streams</A> that do not have a<A HREF="charset.html#state-dependent encoding">state-dependent encoding</A>.</P><H3><A NAME="fpos::operator-"><CODE>fpos::operator-</CODE></A></H3><PRE>streamoff <B>operator-</B>(const fpos& right) const;fpos <B>operator-</B>(streamoff off) const;</PRE><P>The first member function returns <CODE>(streamoff)*this - (streamoff)right</CODE>.The second member function returns <CODE>fpos(*this) -= off</CODE>.</P><H3><A NAME="fpos::operator-="><CODE>fpos::operator-=</CODE></A></H3><PRE>fpos& <B>operator-=</B>(streamoff off);</PRE><P>The member function returns <CODE>fpos(*this) -= off</CODE>.For positioning within a file, the result is generally valid only for<A HREF="lib_file.html#binary stream">binary streams</A> that do not have a<A HREF="charset.html#state-dependent encoding">state-dependent encoding</A>.</P><H3><A NAME="fpos::operator=="><CODE>fpos::operator==</CODE></A></H3><PRE>bool <B>operator==</B>(const fpos& right) const;</PRE><P>The member function returns <CODE>(streamoff)*this == (streamoff)right</CODE>.</P><H3><A NAME="fpos::operator streamoff"><CODE>fpos::operator streamoff</CODE></A></H3><PRE><B>operator streamoff</B>() const;</PRE><P>The member function returns the stored offset member object,plus any additional offset stored as part of the <CODE>fpos_t</CODE> member object.</P><H3><A NAME="fpos::state"><CODE>fpos::state</CODE></A></H3><PRE>St <B><A HREF="#fpos::state">state</A></B>() const;void <B><A HREF="#fpos::state">state</A></B>(St state);</PRE><P>The first member function returns the value stored in the<CODE>St</CODE> member object. The second member functionstores <CODE>state</CODE> in the <CODE>St</CODE> member object.</P><H2><A NAME="hex"><CODE>hex</CODE></A></H2><PRE>ios_base& <B>hex</B>(ios_base& iosbase);</PRE><P>The manipulator effectively calls<CODE>iosbase.<A HREF="#ios_base::setf">setf</A>(ios_base::<A HREF="#ios_base::hex">hex</A>, ios_base::<A HREF="#ios_base::basefield">basefield</A>)</CODE>, then returns<CODE>iosbase</CODE>.</P><H2><A NAME="internal"><CODE>internal</CODE></A></H2><PRE>ios_base& <B>internal</B>(ios_base& iosbase);</PRE><P>The manipulator effectively calls<CODE>iosbase.<A HREF="#ios_base::setf">setf</A>(ios_base::<A HREF="#ios_base::internal">internal</A>, ios_base::<A HREF="#ios_base::adjustfield">adjustfield</A>)</CODE>, then returns<CODE>iosbase</CODE>.</P><H2><A NAME="ios"><CODE>ios</CODE></A></H2><PRE>typedef basic_ios<char, char_traits<char> > <B>ios</B>;</PRE><P>The type is a synonym for template class<A HREF="#basic_ios"><CODE>basic_ios</CODE></A>, specialized forelements of type <I>char</I> with default<A HREF="string2.html#character traits">character traits</A>.</P><H2><A NAME="ios_base"><CODE>ios_base</CODE></A></H2><HR><P><B><CODE><A HREF="#ios_base::event">event</A>· <A HREF="#ios_base::event_callback">event_callback</A>· <A HREF="#ios_base::failure">failure</A>· <A HREF="#ios_base::flags">flags</A>· <A HREF="#ios_base::fmtflags">fmtflags</A>· <A HREF="#ios_base::getloc">getloc</A>· <A HREF="#ios_base::imbue">imbue</A>· <A HREF="#ios_base::Init">Init</A>· <A HREF="#ios_base::ios_base">ios_base</A>· <A HREF="#ios_base::iostate">iostate</A>· <A HREF="#ios_base::iword">iword</A>· <A HREF="#ios_base::openmode">openmode</A>· <A HREF="#ios_base::operator=">operator=</A>· <A HREF="#ios_base::precision">precision</A>· <A HREF="#ios_base::pword">pword</A>· <A HREF="#ios_base::register_callback">register_callback</A>· <A HREF="#ios_base::seekdir">seekdir</A>· <A HREF="#ios_base::setf">setf</A>· <A HREF="#ios_base::streamoff">streamoff</A>· <A HREF="#ios_base::streampos">streampos</A>· <A HREF="#ios_base::sync_with_stdio">sync_with_stdio</A>· <A HREF="#ios_base::unsetf">unsetf</A>· <A HREF="#ios_base::width">width</A>· <A HREF="#ios_base::xalloc">xalloc</A></CODE></B></P><HR><PRE>class <B>ios_base</B> {public: class <B><A HREF="#ios_base::failure">failure</A></B>; typedef T1 <B><A HREF="#ios_base::fmtflags">fmtflags</A></B>; static const fmtflags <B>boolalpha</B>, <B>dec</B>, <B>fixed</B>, <B>hex</B>, <B>internal</B>, <B>left</B>, <B>oct</B>, <B>right</B>, <B>scientific</B>, <B>showbase</B>, <B>showpoint</B>, <B>showpos</B>, <B>skipws</B>, <B>unitbuf</B>, <B>uppercase</B>, <B>adjustfield</B>, <B>basefield</B>, <B>floatfield</B>; typedef T2 <B><A HREF="#ios_base::iostate">iostate</A></B>; static const iostate <B>badbit</B>, <B>eofbit</B>, <B>failbit</B>, <B>goodbit</B>; typedef T3 <B><A HREF="#ios_base::openmode">openmode</A></B>; static const openmode <B>app</B>, <B>ate</B>, <B>binary</B>, <B>in</B>, <B>out</B>,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -