- 论坛徽章:
- 0
|
原帖由 lovesu 于 2006-8-9 15:23 发表
字符串固定,怎么赋值,请问高手
>>
>>
>>大致就像:
>>
>>
//Sat Oct 28 10 : 12 : 05 2000
#include <stdio.h>
int
mian(){
char t_string[] = "Sat Oct 28 10 : 12 : 05 2000";
char t_week[3];
char t_mon[3];
unsigned int t_day;
unsigned int t_hour;
unsigned int t_min;
unsigned int t_sec;
unsigned int t_year;
sscanf(t_string, "%s %s %d %d : %d : %d %d",
t_week, t_mon, &t_day, &t_hour, &t_min, &t_sec, &t_year);
printf("%s %s %d %d : %d : %d %d\n",
t_week, t_mon, t_day, t_hour, t_min, t_sec, t_year);
return 1;
} |
|