std:: ends
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
| Floating-point formatting | |||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
| Integer formatting | |||||||||||||||||||||||||||||||
| Boolean formatting | |||||||||||||||||||||||||||||||
| Field width and fill control | |||||||||||||||||||||||||||||||
| Other formatting | |||||||||||||||||||||||||||||||
| Whitespace processing | |||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
| Output flushing | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Status flags manipulation | |||||||||||||||||||||||||||||||
| Time and money I/O | |||||||||||||||||||||||||||||||
| Quoted manipulator | |||||||||||||||||||||||||||||||
|
(C++14)
|
|||||||||||||||||||||||||||||||
|
定义于头文件
<ostream>
|
||
|
template
<
class
CharT,
class
Traits
>
std:: basic_ostream < CharT, Traits > & ends ( std:: basic_ostream < CharT, Traits > & os ) ; |
||
向输出序列 os 插入一个空字符,如同通过调用 os. put ( CharT ( ) ) 实现。
这是一个仅输出的I/O操纵器,可通过诸如
out
<<
std
::
ends
的表达式调用,适用于任何
out
类型为
std::basic_ostream
的输出流。
目录 |
注释
此操纵符通常与 std:: ostrstream 配合使用,当需要将关联的输出缓冲区以空字符结尾以便作为C字符串处理时使用。
与 std::endl 不同,此操纵符不会刷新流。
参数
| os | - | 输出流引用 |
返回值
os (在插入空字符后的流引用)。
示例
#include <cstdio> #include <strstream> int main() { std::ostrstream oss; oss << "Sample text: " << 42 << std::ends; std::printf("%s\n", oss.str()); oss.freeze(false); // enable memory deallocation }
输出:
Sample text: 42
参见
|
(C++98 中已弃用)
(C++26 中移除)
|
实现字符数组输出操作
(类) |