#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
string buffer;
string str[100];
int count=-1; //记录实际读取行数
char path[]="C:\\Documents and settings\\lizesong\\桌面\\lov.txt";
ifstream ifile; //读文件对象
ifile.open(path);
if(ifile) //如果文件打开成功
{
while(getline(ifile,buffer))
{
str[++count]=buffer.c_str();
}
}
else
{
cerr<<"文件打开失败,退出程序~";
exit(0);
}
ifile.close();
for(int i=0;i<=count;i++)
cout<<str[i]<<'\n';
return 0;
}