For some reason the code is not printing the error string in the output screen of the operating system. Go figure? This code is directly out of the book.
#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
ofstream fileout;
ifstream filein;
void main()
{
char file[20]; //you must type in filename and extension
char inChar;
cout << "What is the name of the file you want to see? ";
cin >> file;
filein.open(file, ios::in);
if(!filein)
{
cout<<"\n\n*** That file does not exist ***\n"; //not displaying for some reason
exit(0);
} while(filein.get(inChar))
{
cout << inChar;
}
filein.close();
return;
}
<< moderator edit: added [code][/code] tags >>