且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ostringstream的字符串构造函数的目的是什么?

更新时间:2022-06-12 05:17:57

使用 ostringstream 并提供初始值就像打开一个现有文件进行写入。你有一些数据,除非你另外指定,你的初始位置将在数据的开始。您可以在数据中查找,或者指定 ios :: ate ,将写入指针初始定位到现有数据的末尾,也可以指定 ios :: app 始终将写入指针定位到现有数据的结尾。

Using an ostringstream and providing an initial value is just like opening an existing file for writing. You have some data there, and unless you specify otherwise, your initial position will be at the beginning of the data. You can seek in the data, or you specify ios::ate to initially position the write pointer to the end of the existing data, or you can specify ios::app to always position the write pointer to the end of the existing data.