Hello
I'm parsing a file with sscanf for strings in the following two formats:
2006 03 Mar ../test/usage_200603.html 755 500 310 28 604 289.19 MB 897 9623 15502 23415
2006 01 Jan ../test/usage_200601.html 10647 6524 4192 113 2146 1263731 3520 129956 202261 330065
The problem is that the code below works for a string of the second format only. But if I want to parse a string of the first format the code doesn't work anymore. Reason: In this case the 10th entry is a string but NOT an integer as in second case. Result: The string will not be parsed (13 entries only)...
Does someone have a code solution for parsing both formats with sscanf in one code routine?? Would be great!! Thank you!!
Code:if (sscanf(inbuf, "%4d %2d %3s %s " "%llu %llu %llu %llu %llu " "%llu %llu %llu %llu %llu\n", &summary_year, &summary_month, summary_mname, summary_path, &summary_dhits, &summary_dfiles, &summary_dpages, &summary_dvisits, &summary_tsites, &summary_tkbytes, &summary_tvisits, &summary_tpages, &summary_tfiles, &summary_thits) == 14)




Reply With Quote