This is my code:
The program cannot open the file, and thus always returns 1;
My text1.txt file is in C:\Documents and Settings\Alex\M y Documents\Visua l Studio 2010\Projects\f requency\freque ncy\text1.txt
How do I make it open the file so 1 is not returned?
Code:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream infile;
infile.open("text1.txt");
if (!infile.is_open())
{
return 1; //if cannot find file, all of the time
}
char response;
cin >> response;
return 0;
}
My text1.txt file is in C:\Documents and Settings\Alex\M y Documents\Visua l Studio 2010\Projects\f requency\freque ncy\text1.txt
How do I make it open the file so 1 is not returned?
Comment