string result="CCY 1.2597 Down 0.0021(0.16%) 14:32 SGT [44]";
char* token;
char* buffer[result.length() + 1]; //Space for '\0'
strcpy(buffer, result.c_str());
buffer[result.length()] = '\0'; //insert '\0'
token = strtok(buffer, " ");
while (token != NULL) {
/* work with token */
token = strtok(NULL, " ");
}
我不确定为什么上面的代码出错了,我的代码有什么问题
main.cpp:51:30: error: cannot convert ‘char**’ to ‘char*’ for argument ‘1’ to ‘char* strcpy(char*, const char*)’
main.cpp:53:27: error: cannot convert ‘char**’ to ‘char*’ for argument ‘1’ to ‘char* strtok(char*, const char*)’
make: *** [main.o] Error 1
BUILD FAILED (exit value 2, total time: 893ms)