按行读取txt中文件
#include<fstream>#include<iomanip>using namespace std;std::ifstream Infile;std::locale::global(std::locale(""));//是为了保证,支持中文的路径。string strLine;Infile.open("D:/name.txt");std::locale::global(std::locale("C"));//设置while (Infile){getline(Infile, strLine);if (strLine.empty())break;}把读取的每行数据进行处理
name.txt
xiaoming 0 80 75 88 66