Whats wrong with my program? Pleeease help!!
Thanks!!
Code:
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
int main()
{
fstream file;
file.open("data.txt", ios::out);
cout << "File object initialised, ready to create and insert text.\n";
cout << "Inserting text...";
file << "Bling\nplock";
cout << "Done\n";
file.close();
cout << "File object closed\n";
cout << "Char array created\n";
char thing[40];
file.open("data.txt", ios::in);
cout << "File object initialised\n";
cout << "Ready to insert text...";
while(!file.eof());
{
file >> thing;
}
cout << "done\n\n";
cout << "Text:\n";
cout << thing;
file.close();
cout << "\nFile object closed\n";
return 0;
}