我写的代码 #include<sstream>
#include<iostream>
using namespace std;
int main(){
strstream temp;
int t =10;
temp>>10;
string tt ="testing"+temp.str();
有一个问题,它不会在所有的临时变量上班,就得到结果,而不只是在最后10串测试? }
我有旧的C++代码使用strstream并使用pcount和冻结方法相同。 我想改为使用stringstream类。什么是strstream的pcount和冻结方法的替代品?该代码是这样的: strstream log; // this will change to: stringstream log;
if (log.pcount()) //????
{
log << ends;
下面的代码编译失败成员: #include <cstdio>
#include <sstream>
int main()
{
std::ostrstream strm;
strm.rdbuf()->freeze(0);
}
我得到编译如下错误: g++ sample3.cpp
sample3.cpp: In function 'int mai