fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. void splitString(const string &str, char delimiter, vector<string> * out) {
  8. istringstream iss(str);
  9. string word;
  10. while (getline(iss, word, delimiter))
  11. out->push_back(word);
  12. }
  13.  
  14. int main() {
  15. vector<string> user_input_tokens;
  16. string port = "209,202,252,54,19,15";
  17. splitString(port, ',', &user_input_tokens);
  18. for (string str : user_input_tokens) {
  19. cout << str << ".";
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
209.202.252.54.19.15.