选择题
若目前D盘根目录下并不存在test.txt文件,则下列打开文件方式不会自动创建test.txt文件的是______。
A、
ifstream fin;fin.open('d:\test.txt',ios_base::in);
B、
fstream fio;fio.open('d:\test.txt',ios_base::out);
C、
ofstream fout;fout.open('d:\test.txt',ios_base::out);
D、
ofstream fout;fout.open('d.\test.txt',ios_base::app);
【正确答案】
A
【答案解析】
本题考查文件流的一些操作,ios::in是以输入方式打开文件,如果并不存在这个文件,也不会自动创建一个新文件,所以A选项正确。
提交答案
关闭