#include<fstream> // for file handling
unsing namespace std;
int main()
{
ifstream in; // declaring a variable
in.open("file.txt"); // opening the file
if(!in)
{
cout<<"No File is Found"<<endl; // if file was not present
return 0;
}
while(in) // this while loop runs till the file is not end
............... // this portion includes the work you want to do with the file
in.close(); // closes the file
return 0;
}
No comments:
Post a Comment