How to convert stringstream to string in C++

1 Answer

0 votes
#include <iostream>  
#include <sstream>  

int main() {  
    std::stringstream ss("c++");  

    std::string s = ss.str();

    std::cout << s;
    
    return 0;
}  




/*
run:

c++

*/

 



answered Jan 14, 2021 by avibootz

Related questions

1 answer 182 views
3 answers 819 views
1 answer 432 views
1 answer 352 views
2 answers 471 views
2 answers 216 views
...