Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道在这种情况下是否有办法避免使用临时字符串:
tempString = inputString.substr(commaLast,commaCurrent-1); yPos = strtod(tempString.c_str(), NULL);
如果不先将子字符串存储在临时字符串中(假设我不想修改原始字符串),就无法使用 substr 命令并返回 c_str 。
您是否尝试过以下操作?
yPos = strtod(inputString.substr(commaLast,commaCurrent-1).c_str(), NULL);