void toScreen(ifstream& ifs)
{
int n;
while(!ifs.eof())
{
cout<<n<<endl;
ifs>>n;
}
}
int main()
{
ifstream ifs;
ifs.open("aaaa.txt");
if(ifs.fail())
{
cout<<"error"<<endl;
exit(1);
}
toScreen(ifs);
ifs.close();
return 0;
}
나라면 while (ifs >> n) 한다.
근데 ifs>>n해도 여러줄이 출력이 안되고 한줄만출력됨;;
http://dblack.tk
커뮤니티 사이트 입니다 많은 이용 부탁 드립니다.