I use the code below just to open a text file. the good() always return false. Please help.
using namespace std;
int main()
{
fstream file1; file1 open("file.txt", ios::in | ios::out); if ( !file1.good() ) { cout << "File is not open" << endl; // this message is ALWAYS displayed system ("PAUSE"); exit (1); }
plik.close(); return 0;
}
Log in to post a comment.
I use the code below just to open a text file. the good() always return false.
Please help.
include <iostream>
include <fstream>
include <stdlib.h>
using namespace std;
int main()
{
fstream file1;
file1 open("file.txt", ios::in | ios::out);
if ( !file1.good() ) {
cout << "File is not open" << endl; // this message is ALWAYS displayed
system ("PAUSE");
exit (1);
}
plik.close();
return 0;
}