// 在字符串"+CMGR: "REC UNREAD", "13776633471",,"10/02/25",11:08:20+3" 中取出 字符串“13776632471”
#include
#include
int main(void)
{
char input[256] = "+CMGR: \"REC UNREAD\", \"13776633471\",,\"10/02/25\",11:08:20+3";
char *p;
/* strtok places a NULL terminator
in front of the token, if found */
p = strtok(input, ",");
if (p)
{
printf("%s\n", 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, ","); // 取出字符串: "13776632471"
if (p)
{
printf("%s\n", p);
}
getch();
return 0;
}
原创,转载请注明地址: wangchenxicool.cublog.cn
阅读(1476) | 评论(0) | 转发(0) |