Search code examples
visual-c++strstream

strstream in c++


I am writing the code

#include<sstream>
#include<iostream>

using namespace std;
int main(){
strstream temp;

int t =10;
temp>>10;

string tt ="testing"+temp.str();

Have a problem, it does not work at all for the temp variable, just get in result only string testing without 10 in the end?

}


Solution

  • You should use operator<<() instead, temp << 10;.