T
Timo
I haven't been using ANSI-C for string parsing for some time, so even
this simple task is problematic:
I have a string tmp_str, which includes date + time + newline in
format: "25.6.2008 21:49".
I try to parse date from this string to variables tmp1, tmp2, tmp3:
1st attempt:
sscanf(tmp_str, "%d.%d.%d", &tmp1, &tmp2, &tmp3);
All variables get value 0.
2nd attempt
sscanf(tmp_str, "%d %d %d", &tmp1, &tmp2, &tmp3);
tmp3 = 25, others 0.
Any suggestions?
this simple task is problematic:
I have a string tmp_str, which includes date + time + newline in
format: "25.6.2008 21:49".
I try to parse date from this string to variables tmp1, tmp2, tmp3:
1st attempt:
sscanf(tmp_str, "%d.%d.%d", &tmp1, &tmp2, &tmp3);
All variables get value 0.
2nd attempt
sscanf(tmp_str, "%d %d %d", &tmp1, &tmp2, &tmp3);
tmp3 = 25, others 0.
Any suggestions?