我想使用std :: getline,但我的编译器告诉我getline没有被识别?std没有会员'getline'?
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <fstream>
#include <cstdlib>
int main(){
using namespace std;
string line;
ifstream ifile("test.in");
if(ifile.is_open()){
while(ifile.good()){
getline(ifile,line);
}
}
}
这很容易。 ;] – karlphillip 2011-04-25 17:36:23
我认为cstring和字符串是相同的,但cstring是为c + +? – pighead10 2011-04-25 17:36:37
@Pig Head:'cstring'用于C-in-C++。它在'std'命名空间中定义了所有旧的C字符串函数('strlen'等)。 – cHao 2011-04-25 17:38:51