Unformatted Input/Output in C++

In programming contest we have to use file to read data in different format and sometimes we have to write the output in a file. So, we have to know how to read from file. Here is the simple way to read from file and write as it in the another file.

    #include<fstream.h>
    void main()
    {
    char c;
    ifstream fin("test.in");
    ofstream fout("test.out");
    while((c=fin.get())!=EOF)
        fout<<c;
    }

In this tutorial, I tried to brief unformatted input/output in C++. Hope you have enjoyed the tutorial. If you want to get updated, like the facebook page https://www.facebook.com/freetechtectrainer and stay connected.

Add a Comment