reading from a file

whenever i try to read in from a file, i get the following message in the command window:
"Input opening file failed"

I put the following code in my program:
ifstream ballot;
int v=0;
ballot.open("ballot1.txt");
if (ballot.fail())
{
cout << "Input file opening failed" <<endl;
exit(1);
}

Now, i know that the files are supposed to be in the same directory, and I think they are( i went to the "Source Files" folder, right clicked, add existing item, and added my txt files im trying to read) I still get this error message. How can I make certain the files are where they are supposed to be?
try
1
2
3
4
5
6
7
8
9
10
11
ifstream ballot;
int v=0;
        if(ballot.is_open());
        {
              //do something
        }
        else
        {
             cout << "Input file opening failed" <<endl;
             exit(1);
         }

Topic archived. No new replies allowed.