Dec 8, 2011 at 5:23pm UTC
Are you sure the file name is "test01" and not "test01.txt"? Remember that Windows likes to make people ignorant by hiding file extensions.
2. Yes, you can use \\ or / for the slashes.
Dec 8, 2011 at 5:29pm UTC
exactly ...its test01.txt
but hidden .. shows only "test01"
but even i put "test01.txt" it does not open.
Dec 8, 2011 at 5:32pm UTC
1 2 3 4 5 6 7
#include <iostream>
#include <fstream>
int main()
{
std::cout << (std::ifstream("test01.txt" ).is_open() ? "Opened" : "Didn't Open" ) << std::endl;
}
Does this work for you?
Last edited on Dec 8, 2011 at 5:33pm UTC
Dec 8, 2011 at 5:36pm UTC
getting "Didn't Open" using both the option test01.txt
and test01
Dec 8, 2011 at 5:37pm UTC
Are you running the built executable directly or are you running it from your IDE?
Dec 8, 2011 at 5:41pm UTC
bbgst ) its in the working directory ..
LB ) I am running from IDE VS 2005
Dec 8, 2011 at 5:42pm UTC
Ah, I'll bet then that the EXE is in some subfolder (like Debug) and that that is where you have the file01.txt? If you run it from your IDE it needs to be in the project directory, not the EXE directory.
Dec 8, 2011 at 5:44pm UTC
Thanks a lot L B ... :) it worked like a magic ..