The lines
size_t startpos = str.find_first_not_of(” \t”);
size_t endpos = str.find_last_not_of(” \t”);
have some "special" kind of double quotes, try the following:
size_t startpos = str.find_first_not_of(" \t");
size_t endpos = str.find_last_not_of(" \t");