[問題] VC++ string問題
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
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章