📄 ios.htm
字号:
Return None
</pre>
<h3>Description</h3>
<p>
This exceptions() method sets the exception mask that is associated with the ios object.
The exception mask determines additional conditions under which the clear() method will
throw an exception. For example:
</p>
<p>
cout.execptions(ios_base::badbit | ios_base::failbit);
</p>
<p>
sets the exception mask so that clear() will throw an exception when badbit or failbit
is set.
</p>
<hr>
<pre>
<a name="fail">Method fail()</a>
Access Public
Classification Accessor
Syntax bool fail() const;
Parameters None
Return The fail() method returns true(non zero value) if either the badbit is set or the
failbit is set.
</pre>
<h3>Description</h3>
<p>
If a buffer is in a bad state it is also in a fail state. However, a buffer can be in a fail
state without being in a bad state. An operation may fail and the stream may still be usable.
However if badbit is set then the stream is not usable. The fail() member function
returns true(non zero value) if either the badbit is set or the failbit is set.
</p>
<hr>
<pre>
<a name="fill1">Method fill()</a>
Access Public
Classification Accessor
Syntax char_type fill() const;
Parameters None
Return The fill() method returns the current fill character
</pre>
<h3>Description</h3>
<p>
This fill() method returns the fill character and takes no arguments.
</p>
<hr>
<pre>
<a name="fill2">Method fill()</a>
Access Public
Classification Modifier
Syntax char_type fill(char_type Ch);
Parameters None
Return The fill() method returns the previous fill character
</pre>
<h3>Description</h3>
<p>
The fill() method will set the fill character to Ch and return the previous fill character.
</p>
<hr>
<pre>
<a name="good">Method good()</a>
Access Public
Classification Accessor
Syntax bool good() const;
Parameters None
Return If no iostate flags are set then good() returns true.
</pre>
<h3>Description</h3>
<p>
The good() member function returns a non zero value if the buffer component is in a good state.
</p>
<hr>
<pre>
<a name="init">Method init()</a>
Classification Modifier
Access Protected
Syntax void init(basic_streambuf<charT,traits>* Sb);
Parameters Sb is a pointer to a basic_streambuf object. The Sb
object will be used as the buffer for the connected stream.
Return None
</pre>
<h3>Description</h3>
<p>
The init() method helps to initialize the data members of the ios_base and basic_ios components.
The flags are initialized to either goodbit or badbit. After init(Sb) the width() method
will return zero. The default precision will be set to 6. The fill character will be ' '.
Locale is set to the standard locale. Both iword and pword are set to null.
</p>
<hr>
<pre>
<a name="rdbuf1">Method rdbuf()</a>
Access Public
Classification Accessor
Syntax basic_streambuf<charT,traits>* rdbuf() const;
Parameters None
Return This method returns a pointer to the current streambuf object that is contained
in the ios component.
</pre>
<h3>Description</h3>
<p>
This rdbuf() method returns the buffer component of the ios object.
</p>
<hr>
<pre>
<a name="rdbuf2">Method rdbuf()</a>
Syntax basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* Sb);
Classification Modifier
Access Public
Parameters The pointer to the buffer component of the ios object will be set to
to the value of Sb.
Return This method returns a pointer to the previous streambuf object that is contained
in the ios component.
</pre>
<h3>Description</h3>
<p>
This rdbuf() method updates the streambuf pointer to the pointer stored in Sb. The
method returns a pointer to the previous buffer.
</p>
<hr>
<pre>
<a name="rdstate">Method rdstate()</a>
Access Public
Classification Accessor
Syntax iostate rdstate() const;
Parameters None
Return This method returns a copy of the stream state variable.
</pre>
<h3>Description</h3>
<p>
This method returns the stream state.
</p>
<hr>
<pre>
<a name="setstate">Method setstate()</a>
Classification Modifier
Access Public
Syntax void setstate(iostate State);
Parameters The value of State is the new value for the corresponding bit in the
stream state variable.
Return None
</pre>
<h3>Description</h3>
<p>
The setstate() method resets the iostate variable to the value stored in State.
</p>
<hr>
<pre>
<a name="tie1">Method tie()</a>
Access Public
Classification Accessor
Syntax basic_ostream<charT,traits>* tie() const;
Parameters None
Return a pointer to the stream that is currently tied.
</pre>
<h3>Description</h3>
<p>
This tie() method returns a pointer the stream (if any) that is tied to the
stream connected to this ios object.
</p>
<hr>
<pre>
<a name="tie2">Method tie()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* Str);
Parameters Str will point to a new stream to tie the current stream to.
Return a pointer to the previously tied stream.
</pre>
<h3>Description</h3>
<p>
This tie() method will tie Str to the stream that is currently connected to this
ios object. This tie() method returns a pointer the stream (if any) that was tied to the
stream connected to this ios object.
</p>
<hr>
<p>
<a name="diagram"><h2>The Class Relationship Diagram of basic_ios</h2></a>
<img src="basicios.gif">
</p>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -