我正在研究从文件读取并将该文件的内容推回到向量中的程序。它会读取,直到文件到达一个空间并将该字符串推入矢量,然后在该空间后继续。我写了这段代码。从C++ ifstream中读取文件
ifstream inFile;
inFile.open("message1.txt");
if (inFile.fail()) {
cerr << "Could not find file" << endl;
}
while (inFile >> S) {
code1.push_back(S);
}
我对这段时间(inFile >> S)实际上只是感到困惑。我知道它从inFile中读取,直到文件结束。但inFile >> S条件实际上做了什么?谢谢你的时间。