Can't get ifstream to work in C++

Hi,
I'm trying to read a text file in a C++ program using an ifstream object but it keeps saying that it can't open the file. Here's a partial version of the code i'm using. Can anyone tell me why it's not reading the file? Am I missing a library or some other important part? The text file is in the same folder as my Xcode project file.

#include <vector>
#include <fstream>
#include <iostream>
#include <string>

#define FILE_IN "Pool LogData.txt"

using namespace std;


bool ReadFile(vector<string> & rvMonthYr, vector<int> & rvRecSwim,
vector<int> & rvLapSwim, vector<int> & rvLessons)
{
ifstream input;
input.open(FILE_IN);

//check that the file is open

if(!input)
{
cout << "\nSorry, there was a problem opening the file.";
return false;
}

iBook G4 Power PC 1.2GHz

Posted on Nov 23, 2008 7:03 PM

Reply
3 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can't get ifstream to work in C++

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.