Dr.Bk
2010-10-02 21:19:00 UTC
My problem is:
ifstream does not read my txt file and main always returns 1.
This is my code:
#include
#include
#include
#include
using namespace std;
int main()
{
ifstream infile("text1.txt");
if (!infile)
{
return 1; //if cannot find file, all of the time
char response;
cin >> response;
return 0;
}
It does not recognize my txt file "text1.txt", which is a single word "cool".
It is in C:\Documents and Settings\My Documents\Visual Studio 2010\Projects\frequency\frequency\text1.txt
please assist if you can