c语言分割字符串-----(strtok)
int main(void) {
char str[] = "now # is the time for all # good men to come to the # aid of their country";
char delims[] = "#";
char *result = NULL;
result = strtok( str, delims );
while( result != NULL ) {
printf( "%s\n", result );
result = strtok( NULL, delims ); }
system("pause");
return 0;
}
//结果输出: now is the time for all good men to come to the aid of their country

浙公网安备 33010602011771号