From: heister Date: Fri, 8 Feb 2013 22:44:26 +0000 (+0000) Subject: fix time extractor to parse names with spaces X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=888b06fa7f97f7e2ca33de1cfcc801626b0bc42d;p=dealii-svn.git fix time extractor to parse names with spaces git-svn-id: https://svn.dealii.org/trunk@28285 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/benchmarks/gettimes/get_times.cc b/tests/benchmarks/gettimes/get_times.cc index 8018899cd2..41bc557a0c 100644 --- a/tests/benchmarks/gettimes/get_times.cc +++ b/tests/benchmarks/gettimes/get_times.cc @@ -50,17 +50,23 @@ int main(int argc, char *argv[]) { if (curr_line[1] == ' ') first_char++; + ////cout << "first char at pos: " << first_char << endl; //Test case: char at position first_char is a letter assert(isalpha(curr_line[first_char])); - //Find position of first space that occurs after the word + //Find end of string int num_chars = 0; - while(!isspace(curr_line[first_char + num_chars])) + while(curr_line[first_char + num_chars] != '|') num_chars++; - - names.push_back(curr_line.substr(first_char, num_chars)); + + num_chars--; + + while(curr_line[first_char + num_chars] == ' ') + num_chars--; + + names.push_back(curr_line.substr(first_char, num_chars+1)); } }