Do you know why the file can't be opened? Sometimes it's more informative to get some internal error messages going rather than your own:
Code:
#include <fstream>
#include <cstdio>
#include <cstdlib>
int main()
{
std::ifstream fin ( "C:\\Documents and Settings\\user 3\\My Documents\\TestData\\data.txt" );
if ( !fin ) std::perror ( 0 );
std::system ( "PAUSE" );
}
A good idea for any IDE is to find out exactly where the files are expected. I usually forget and end up opening a file for writing, then go find it to see where I should put my files for reading. Spaces in the path and/or directory names over 8 characters also seem to be an issue with Windows, so you may need to remove them with that tilde thingie:
Code:
std::ifstream fin ( "C:\\docume~1\\user 3\\mydocu~1\\TestData\\data.txt" );