作者hsiaotzu0911 ()
看板C_and_CPP
标题[问题] VC++ string问题
时间Thu Apr 9 16:30:13 2009
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