我想从文件中读取每个单词。它打开文件但没有进入while循环
string x;
ifstream inFile ("test.txt");
if (!inFile) {
cout << "Unable to open file";
exit(1); // terminate with error
}
while (inFile >> x) {
cout << "hi" << endl;
}
cout << "hsiwsdsc" << endl;
inFile.close();