hi,
in this simple program to learn the i / o on files, the code works, but it always fails to open the file.
what determines the success of the call of the function member
It worked for me. It opened the file and printed, "why dont open the file ?" and then closed file and exited program. Is that what it is supposed to do?
ar2007, If you use VC++, you may need to place the file in the project directory instead of the executable directory. The issue is the change in working directory.
See, the "testfile.txt" file should be in the same location as your code, if your code is under a folder called Texts then your" testfile.txt" file should also be in there......same location
Some explenation why it did not work.
Your say test_file.open and then ( "testfile.txt", ios::in | ios::out ); The "testfile.txt" basically says the Programm
"Look for a testfile.txt File in the folder of the .exe. Is it there?"