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 185 views
3 answers 824 views
1 answer 434 views
1 answer 354 views
2 answers 474 views
2 answers 219 views
...