strtok, _strtok_l, wcstok, _wcstok_l, _mbstok, _mbstok_l分词函数

来源:互联网 发布:手机淘宝删不了评价 编辑:程序博客网 时间:2024/05/29 14:49
// crt_strtok.c// compile with: /W3// In this program, a loop uses strtok// to print all the tokens (separated by commas// or blanks) in the string named "string".//#include <string.h>#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some  more tokens";char seps[]   = " ,\t\n";char *token;int main( void ){   printf( "Tokens:\n" );    // Establish string and get the first token:   token = strtok( string, seps ); // C4996   // Note: strtok is deprecated; consider using strtok_s instead   while( token != NULL )   {      // While there are tokens in "string"      printf( " %s\n", token );      // Get next token:       token = strtok( NULL, seps ); // C4996   }}

0 0
原创粉丝点击