以下代码可以执行:
const char* data_file="g:\\data.txt";
CFile output_file;
CFileException e;
if( !output_file.Open(data_file, CFile::modeCreate   |CFile::modeReadWrite,&e) ) AfxMessageBox("错误!找不到文件");
return;
}
但我不想指定g:\\data.txt为固定路径,而是让data.txt跟程序是在一个目录下而不管程序所在路径如何。怎样打开当前目录(程序所在目录)下的data.txt?把const char* data_file="g:\\data.txt"改为const char* data_file="data.txt"
没用啊。而且即使文件不存在时也没有提示出错?