📄 ostream.htm
字号:
<html>
<head>
<title> The basic_ostream(ostream) Class</title>
</head>
<body bgcolor="#FFFFFF">
<img src="ostrban.gif">
<pre>
<font size=5>Class Name</font> basic_ostream
<font size=5>Header File</font> <ostream>
<font size=5>Classification</font> Input/Output (Format Class)
</pre>
<a href="ostream.htm#diagram">Class Relationship Diagram</a><br>
<br>
<a href="ostream.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>
<a href="ios.htm">basic_ios</a><br>
<a href="sentry.htm">sentry</a><br>
<h1>Methods</h1>
<pre>
<a href="ostream.htm#ostream1">explicit basic_ostream(basic_streambuf<char_type,traits>* Sb)</a><br>
<a href="ostream.htm#ostream2">virtual ~basic_ostream()</a><br>
<a href="ostream.htm#put">basic_ostream<charT,traits>& put(char_type CharValue)</a><br>
<a href="ostream.htm#write">basic_ostream<charT,traits>& write(const char_type* Str, streamsize Num)</a><br>
<a href="ostream.htm#flush">basic_ostream<charT,traits>& flush()</a><br>
<a href="ostream.htm#tellp">pos_type tellp()</a><br>
<a href="ostream.htm#seekp1">basic_ostream<charT,traits>& seekp(pos_type Pos)</a><br>
<a href="ostream.htm#seekp2">basic_ostream<charT,traits>& seekp(off_type Pos, ios_base::seekdir Dir)</a><br>
</pre>
<hr>
<a name="desc"><h3>Class Description</h3></a>
<p>
The basic_ostream class implements the notion of the object oriented output stream. This
object oriented output stream can be a binary stream or a text stream. The object
oriented stream can be buffered, or unbuffered. The basic_ostream class has facilities
to process single characters, or blocks of characters. When characters or blocks of
characters are sent to an basic_ostream object the operation is referred to as <i>insertion.</i>
The cout and wcout objects are examples of basic_ostream objects that have been pre-defined.
</p>
<hr>
<pre>
<a name="ostream1">Method basic_ostream()</a>
Access Public
Classification Constructor
Syntax explicit basic_ostream(basic_streambuf<charT,traits>* Sb)
Parameters Sb is the buffer object that will be used for the ostream
object.
Return None
</pre>
<h3>Description</h3>
<p>
This basic_ostream() method is used to construct an object of type basic_ostream.
</p>
<hr>
<pre>
<a name="ostream2">Method basic_ostream()</a>
Access Public
Classification Constructor
Syntax virtual ~basic_ostream()
Parameters None
Return None
</pre>
<h3>Description</h3>
<p>
This basic_ostream() method is used to destruct an object of type basic_ostream.
</p>
<hr>
<pre>
<a name="put">Method put()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>& put(char_type CharValue)
Parameters CharValue is the character that is inserted into the
output stream
Return This method returns a reference to the current ostream object.
</pre>
<h3>Description</h3>
<p>
The put() method is used to insert a character into the output stream.
</p>
<hr>
<pre>
<a name="write">Method write()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>& write(const char_type* Str, streamsize Num)
Parameters Num characters are inserted into the output stream starting at the location
pointed to by Str.
Return This method returns a reference to the current ostream object.
</pre>
<h3>Description</h3>
<p>
The write() method is used to insert a character into the output stream. The insertion
operation will continue until Num characters are inserted into the output stream or
until an error condition occurs. If the output operation fails an exception may
be thrown e.g.
<pre>
ios_base::failure
</pre>
</p>
<hr>
<pre>
<a name="flush">Method flush()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>& flush()
Parameters None
Return This method returns a reference to the current ostream object.
</pre>
<h3>Description</h3>
<p>
The flush() method has the effect of calling <a href="istream.htm#sync">sync</a>.
</p>
<hr>
<pre>
<a name="tellp">Method tellp()</a>
Access Public
Classification Accessor
Syntax pos_type tellp()
Parameters None
Return This method returns the current put position.
</pre>
<h3>Description</h3>
<p>
The tellp() method returns the current position of put pointer in the output stream.
</p>
<hr>
<pre>
<a name="seekp1">Method seekp()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>& seekp(pos_type Pos)
Parameters Pos is the position in the output stream that the point pointer
will be moved to.
Return This method returns a reference to the current ostream object.
</pre>
<h3>Description</h3>
<p>
The seekp() method performs an absolute seek Pos from the beginning of the output
stream.
</p>
<hr>
<pre>
<a name="seekp2">Method seekp()</a>
Access Public
Classification Modifier
Syntax basic_ostream<charT,traits>& seekp(off_type Pos, ios_base::seekdir Dir)
Parameters Pos is the position in the output stream that the point pointer
will be moved to relative Dir. Dir can have the following
values
ios_base::beg
ios_base::cur
ios_base::end
Return This method returns a reference to the current ostream object.
</pre>
<h3>Description</h3>
<p>
The seekp() method performs an relative seek to Pos from the direction specified by
Dir.
</p>
<hr>
<a name="diagram"><h2>The Class Relationship Diagram of basic_ostream</h2></a>
<img src="ostream.gif">
</p>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -