问题
单项选择题
若磁盘上已存在某个文本文件,其全路径文件名为d:\ncre\test.txt,下列语句中不能打开该文件的是
A.ifstream file("d:\ncre\test.txt");
B.ifstream file("d:\\ncre\\test.txt");
C.ifstream file;file.open("d:\\ncre\\test.txt");
D.ifstream*pFile=new ifstream("d:\\ncre\\test.txt");
答案
参考答案:A
解析: 文件流的打开路径用“\\”隔开,而不是“\”,但可以用“/”隔开。