Hello,
IMHO there's an error in the first version of your code ( the second strtok); this is my version of code (probably is what you wanted); anyway it doens't work because at //*, line takes "nullptr" and this first loop end...any hints?
Qt Code:
  1. vector<double> v;
  2. vector< vector<double> > doubleVector;
  3. char* line;
  4. line = strtok(_buffer, "\r\n");
  5. while ( line != NULL ) {
  6. cout << line << endl;
  7. char* value = strtok(line, ",");
  8. while ( value != NULL) {
  9. cout << value << endl;
  10. v.push_back( strtod(value, NULL) );
  11. value = strtok(NULL, ",");
  12. }
  13. doubleVector.push_back(v);
  14. v.clear();
  15. line = strtok(NULL, "\r\n"); //* <------ problem
  16. }
To copy to clipboard, switch view to plain text mode