有人能幫助我理解這一段代碼:C++:sscanf的行爲
char *line = new char[2048];
char *probableCauseStr = new char[512];
char *additioanl_text = new char[512];
long holdPeriod = 0;
while(!f.eof()) {
f.getline(line, 2048);
//
// find the ',' seperator
//
char* p = StrMgt::strchr(line, ',');
if(!p) continue;
*p = '\0';
p++;
if(sscanf(line, "%s%s", probableCauseStr, additioanl_text) != 1 ||
sscanf(p, "%ld%s", &holdPeriod, additioanl_text) != 1) continue;
....
我迷路試圖找出與字符指針p會發生什麼。
謝謝。這解釋了預期的行爲。 – Shree 2011-02-25 08:22:55