fork download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. int main()
  5. {
  6. std::istringstream stm( " abcd, efghijk, lmnopq" ) ;
  7. std::string str ;
  8. while( std::getline( stm, str, ',' ) )
  9. std::cout << '"' << str << '"' << '\n' ;
  10. }
  11.  
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
"     abcd"
"     efghijk"
" lmnopq"