C++ program to read content of a FILE

//to read content of a file created in above program as MyFile.txt

#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
int main()
{
    char ch;
    ifstream in("MyFile.txt");
    in>>ch;
    while(in)
    {
        cout<<ch;
        in>>ch;
    }
    in.close();
    return 0;
}

No comments:

Post a Comment