0
我幾天前發佈了這個問題,我只是有另一個問題,我輸出數據的第一行,但它輸出其餘的線有點難倒。沒有得到線 - std :: getline
ifstream myReadFile;
myReadFile.open("Data.txt");
system("cls");
std::cout << "Wip" << std::endl;
ifstream myReadFile;
myReadFile.open("Data.txt");
std::string output;
std::getline(myReadFile, output);
std::cout << output << "\n";
myReadFile.close();
system("pause");
return 0;
樣本數據
Name: jobes lobes
Age: 89
Address: 9 neuern_st mucgregor brosbane australia
那麼,你只是讀第一行。你想做一個'while'循環來讀取文件直到達到EOF。 –
'cat Data.txt'。 SRY。 –