1在头文件sstream中定义的
2是c字符集操作模板类
不使用snprintf,而是通常用于流输出操作,格式化字符串并避免申请大量缓冲区。 例如,如果需要设置字符串格式,但不知道需要多少缓冲区,则可以使用ostringstream类。 可以根据内容自动分配内存并管理该内存。
4 c官网http://www.cplusplus.com/reference/s stream/ostringstream /
5个样本
ostringstreamostr1; //结构方式1//OstringStreamostr2('ABC ); //结构方式2ostr1'ostr1'2012endl; //格式,这里是endl也格式化为ostr1的coutostr1.str (;