Saturday, December 11, 2010

Reading From a File

#include<fstream> // for file handling
unsing namespace std;
int main()
     ifstream in; // declaring a variable"file.txt"); // opening the file 
                   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