fork(48) download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <vector>
  4. int main()
  5. {
  6. char largechars[] = "def1:def2:def3#abc1:abc2:abc3#ghi1:ghi2:ghi3";
  7. std::vector<char*> v;
  8. char* chars_array = strtok(largechars, "#");
  9. while(chars_array)
  10. {
  11. v.push_back(chars_array);
  12. chars_array = strtok(NULL, "#");
  13. }
  14.  
  15. for(size_t n = 0; n < v.size(); ++n)
  16. {
  17. char* subchar_array = strtok(v[n], ":");
  18. while (subchar_array) {
  19. // MessageBox(NULL, subchar_array, NULL, NULL);
  20. std::cout << subchar_array << '\n';
  21. subchar_array = strtok(NULL, ":");
  22. }
  23. }
  24. }
  25.  
Success #stdin #stdout 0s 2856KB
stdin
Standard input is empty
stdout
def1
def2
def3
abc1
abc2
abc3
ghi1
ghi2
ghi3