str="600601.SH 20160428 143317 4.45 4.45 4.47 4.33 5500 4.38 20507339 4.9 4.01 0 0 0 4.39 4.38 7200 414246 4.4 4.37 190700 397400 4.41 4.36 247300 303800 4.42 4.35 231700 432500 4.43 4.34 148300 150221 "
我想得到的是 a = 600601.SH b=20160428 c=...............
試試sscanf格式化提取?
#include<stdio.h>
int main()
{
char *str = "600601.SH 20160428 143317 4.45";
char code[10],date[10];
double a,b;
sscanf(str, "%s %s %lf %lf", code, date, &a, &b);
printf("%s %s %lf %lf\n", code, date, a, b);
}