strtok函数的使用。可以进行拆分????
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( "result is \"%s\"\n", result );
result = strtok( NULL, delims );
}
以上代码的运行结果是:
result is "now "
result is " is the time for all "
result is " good men to come to the "
result is " aid of their country"
阅读(1224) | 评论(0) | 转发(0) |