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 110 views
3 answers 677 views
1 answer 347 views
1 answer 272 views
2 answers 353 views
2 answers 111 views
...