📜  cpp 按空格分割字符串 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:56.149000             🧑  作者: Mango

代码示例2
// Extract the first token
char * token = strtok(string, " ");
// loop through the string to extract all other tokens
while( token != NULL ) {
  printf( " %s\n", token ); //printing each token
  token = strtok(NULL, " ");
}
return 0;