更新时间:2022-11-07 23:12:21
也许,如果您查看源文件中的第32行
Perhaps, if you look at line number 32 in your source file
Error 1 error C2039: 'c' : is not a member of 'std::basic_string<_Elem,_Traits,_Ax>' c:\users\sama\documents\visual studio 2010\projects\11\11\11.cpp 32
最后的数字是行号.
在VS中,可以通过按CTRL + G转到特定的行号.
既然您似乎没有向我们显示错误行,这完全取决于您,但是我怀疑存在拼写错误!
The number at the end is the line number.
In VS, you can go to a specific line number by pressing CTRL+G.
Since you don''t appear to have shown us the line with the error, it is going to be up to you, but I suspect a spelling error!
OriginalGriff是绝对正确的:
OriginalGriff is absolutely correct:
if(ifs){
for(int i=0 ; i<100 && !ifs.eof();i++){
getline(ifs,c);
b=c.c_str(); //you had "c-str"
memory[i]=atoi(b);
counter++;
}
ifs.close();
}
您发布的代码与您的错误无关.我猜你在某个地方写了
The code you posted is not related to your errors. I would guess you somewhere have written
string s;
s.c;
// or
s.c();
您打算写s.c_str()
吗?
在第32行上检查文件c:\ users \ sama \ documents \ visual studio 2010 \ projects \ 11 \ 11 \ 11.cpp
Did you intend to write s.c_str()
?
Check the file c:\users\sama\documents\visual studio 2010\projects\11\11\11.cpp on line 32