I can't seem to get it to work. I've tried using the full path name, as well as putting the file in the same directory as the dev c++ folder, but I am unable to open the file. Here's my code:
Code:#include <iostream> #include <fstream> using namespace std; int main() { ifstream inFile("C:\\Documents and Settings\\user 3\\My Documents\\TestData\\data.txt"); if(!inFile) { cout<<"error opening file"<<endl; } system("PAUSE"); return 0; }



LinkBack URL
About LinkBacks



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: