[問題] VC++ string問題

看板C_and_CPP (C/C++)作者時間16年前 (2009/04/09 16:30), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
void getnextID(string name){ string tempstr; while(!file.eof()){ file.getline(record,sizeof(record)); if(strstr(record,string)){ //在某行中讀到辨識字串 strtok(strstr(record,string)+15,"\"") >> tempstr; if( checkerror(tempstr) == 1){ nextID<<strtok(strstr(record,string)+15,"\"")<<endl; //將以ID為起始位置的字串對"做token 取出ID friendNum ++; //計算ID個數 } } } } 這只是片段程式碼 但是我在宣告string tempstr的時候出現error 以下是錯誤訊息 y:\.....\ : error C2146: 語法錯誤 : 遺漏 ';' (在識別項 'tempstr' 之前) y:\documents\...\catchdata.cpp(121) : error C2065: 'tempstr' : 未宣告的識別項 y:\documents\...\catchdata.cpp(127) : error C2065: 'tempstr' : 未宣告的識別項 但是其他地方宣告string就沒有問題 想請問是什麼原因 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.234.149
文章代碼(AID): #19tR8M00 (C_and_CPP)
文章代碼(AID): #19tR8M00 (C_and_CPP)