Sunday, March 17, 2013

Reading A File

#include<iostream.h>
#include<fstream.h>
int main()
{
    const int N=80;
    char name[N];
    ifstream fin;
    fin.open("a.DAT");
    cout<<"Contents of Capital file: \n\n\n";
    while(fin)
    {
        fin.getline(name,N);
        cout<<"\t"<<name<<"\n";
    }
    fin.close();
    return 0;
}

0 comments:

Post a Comment