N
news.hku.hk
Excuse me, could you point out why the command below will generate error?
And how to overcome this problem by still using string?? i know char array
is ok but i don't want to use it. Thanks a lot
int main(){
ifstream ifs("abc.txt", ios::in);
if (!ifs){
cerr << "Cannot open abc.txt for input" << endl;
return 1;
}
string buffer;
ifs.getline(buffer, 500, '\n'); // why has error this line
Billy
And how to overcome this problem by still using string?? i know char array
is ok but i don't want to use it. Thanks a lot
int main(){
ifstream ifs("abc.txt", ios::in);
if (!ifs){
cerr << "Cannot open abc.txt for input" << endl;
return 1;
}
string buffer;
ifs.getline(buffer, 500, '\n'); // why has error this line
Billy