Hello, I have recently installed and registered C++ builder CE, my first test program is not behaving correctly. It's a trivial C++ program, the file open fails. There is nothing that I can see that is incorrect, I've coded with files for decades. Any suggestions appreciated.
#include <iostream>
#include <fstream>
#include <conio.h>
#include <tchar.h>
using namespace std ;
ifstream ifs ;
int _tmain(int argc, _TCHAR* argv[])
{
ifs.open ("C:\\Junk\\testfile.txt") ;
if (!ifs.good())
// ** Also tried if (!ifs)
{
cout << "Can't open input file.\n";
while (!kbhit()) ;
return 1 ;
}
cout << "Opened OK\n" ;
ifs.close() ;
while (!kbhit()) ;
return 0 ;
}