Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   InFile help please (http://www.go4expert.com/forums/infile-help-please-t14237/)

smoothsensation 28Sep2008 11:14

InFile help please
 
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 28Sep2008 22:02

Re: InFile help please
 
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.


All times are GMT +5.5. The time now is 05:25.