InFile help please

smoothsensation's Avatar, Join Date: Sep 2008
Newbie Member
All right so I need to use infile to open the file the user inputs.

For example:

Enter file name: Program.txt

I need to be able to open program.txt or any other program name the user inputs and if the file doesnt exist then my program should output an error message.
The code i have for it is

#include <iostream>
#include <fstream>
#include <iomanip>

char name[81]
ifstream infile;
inFile.open(name);
if(inFile.fail)
cout << "Cant find file";

I get an error at inFile.open(name) saying infil hasnt been declared. I thought using the #include <fstream> at the top allowed me to use it. Any help on this would be nice.
smoothsensation's Avatar, Join Date: Sep 2008
Newbie Member
Nevermind I dont have the problem anymore... I just finished writing the rest of the code and the error just dissapeared rofl. I have another prob now though but i'll have to post in a new thread.