Originally Posted by
Dave_Sinkula
*Ahem*
Are you running the executable from the command line?
Are you running the executable from an IDE?
How are you getting either "c:\whatever\whatever\text.txt" or "C:\\Whatever\\text.txt"?
If the path contains spaces, are you enclosing it in double quotes?
Shall we continue playing 20 questions?
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string x;
//ifstream wordfile("c:\\documents and settings\\owner\\my documents\\code\\word.txt");
ifstream wordfile("word.txt");
getline(wordfile, x);
cout << x << endl;
cin.get();
}
The commented out part is the path that works. The second path, does not. And yes, i've tried BOTH ways of running the executable(ide and cmd). My lack of c++ knowledge doesn't translate to a complete lack of any computer knowledge. I've just mainly been hardware up to this point.