可能是重复问题:
如何在C++中对字符串进行标记化?
你好,我想知道如何使用strtok对std字符串进行标记化。
string line = "hello, world, bye";
char * pch = strtok(line.c_str(),",");
我遇到了以下错误。
error: invalid conversion from ‘const char*’ to ‘char*’
error: initializing argument 1 of ‘char* strtok(char*, const char*)’
我正在寻找一种快速简便的方法,因为我认为这不需要太多时间。