69,377
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char res_info[30]={0};
char *buffer ="250-20090821103023";
char *tmp = NULL;
char tmp_msg_id[10] = {0};
unsigned int msg_id ;
tmp = strstr(buffer, "-");
if( tmp != NULL)
{
strncpy(tmp_msg_id, buffer, (tmp-buffer));
printf("tmp_msg_id = %s\n",tmp_msg_id);
msg_id = atoi(tmp_msg_id);
strcpy(res_info, tmp+1);
printf("res_info %s\n", res_info);
printf("msg_id %ud\n", msg_id);
}
return 0;
}
~