C++如何一行一行读取txt文件中数据并存入相应数组?
C++如何一行一行读取txt文件中数据并存入相应数组?
日期:2020-03-24 21:50:26 人气:1
1)从文件读取一行:
ifstream
infile;
infile.open("文件名.txt");
if
(!infile)
{
cerr
<<
"error:
unable
to
open
input
file
!!!"
<<
endl;
system("pause");
}
string
str;
while
(getline(infile,
str))
{