Professional Documents
Culture Documents
C++ Reading A Text Into A File
C++ Reading A Text Into A File
C++ Reading A Text Into A File
int main()
{
fstream file; //object of fstream class
if(!file)
{
cout<<"Error in creating file!!!"<<endl;
return 0;
}
if(!file)
{
cout<<"Error in opening file!!!"<<endl;
return 0;
}
while(!file.eof())
{
file>>ch; //read single character from file
cout<<ch;
}
return 0;
}