当前位置:网站首页 > 技术博客 > 正文

strtok函数用法



函数名: strtok
功 能: 查找由在第二个串中指定的分界符分隔开的单词
用 法: #include <string.h>
        char *strtok(char *str1, char *str2);
程序例:










#include <string.h>
#include <stdio.h>

int main(void)
{
   char input[16] = "abc,d";
   char *p;







   /* strtok places a NULL terminator
   in front of the token, if found */
   p = strtok(input, ",");
   if (p)   printf("%s ", p);







   /* A second call to strtok using a NULL
   as the first parameter returns a pointer
   to the character following the token */
   p = strtok(NULL, ",");
   if (p)   printf("%s ", p);
   return 0;
}




















  
       

  • 上一篇: 循环队列详解
  • 下一篇: img标签常见操作
  • 版权声明


    相关文章:

  • 循环队列详解2025-06-22 22:01:02
  • jrebel插件下载2025-06-22 22:01:02
  • offsetfromutc2025-06-22 22:01:02
  • mongodb正则匹配查询2025-06-22 22:01:02
  • 如何求nextval数组2025-06-22 22:01:02
  • img标签常见操作2025-06-22 22:01:02
  • 视觉slam是什么2025-06-22 22:01:02
  • 什么叫js文件2025-06-22 22:01:02
  • tftp软件下载2025-06-22 22:01:02
  • dbcp dbcp22025-06-22 22:01:02