File I/O Question

I have declared all files correctly
#include <fstream>
ofstream outdata;
opened file
closed file
etc. but i don't understand why I can't read the data from the output file to the prompt?

1
2
3
4
5
6
7
string line;
    outdata << "history ";
    while(!outdata.eof())
    {
        getline(outdata,line);
        cout << line;
    }
ofstreams are for file OUTput, if you want to read data in you want to use an ifstream.
Topic archived. No new replies allowed.