i notice when i execute the executable and the txt file is in the same folder it does what its supposed to do but when i debug it doesnt open the txt file. Also, im not even sure where to put the txt file for the complier to find the text file so i can debug with it
Also, how can i direct where to find the txt file i want to open?
this is what i have in the main.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ifstream ifs("csvTEST.txt", ifstream::in);
cout << textLine << endl;
cout << "ERROR: can't open file." << endl;
O_o I don't see why you have to call it relative or absolute your making it sound more confusing than it actually is.
When he wrote "Data/csvTEST.txt" the folder that your .exe is made is will be consider its own directory. So what he wrote told the program to look one level down from the main area into a folder called Data that has a text file called csvTEST.
When you add C://Programfiles//Projectdir//Data//csvTEST.txt its like you are telling the computer to leave your directory and look into another directory also on your computer, also you can tell it to look in your directory as well which is what xkcd83 did.
For example another directory could of been
where the directory is Documents and within that directory 1 level down you would enter folder called textfiles and in that folder there is a file called csvTEST.txt
You should try using the command prompt on your computer it will give you a better idea of how it works.
@Stormhawk: You're getting the slashes mixed up. '\' is an escape character so it needs to be doubled up on. '/' is usually (BUT NOT ALWAYS) an acceptable replacement for what you would normally see in a directory.