单选题
要建立文件流并打开当前目录下的文件file.dat用于输入,下列语句中错误的是( )。
A、
ifstream fin=ifstream.open(''file.dat'');
B、
itstream*fin=ew ifstream(''file.dat'');
C、
ifstream fin;fin.open(''file.dat'');
D、
ifstream*fin=new ifstream0;fin->open(''file.dat'');
【正确答案】
A
【答案解析】
解析:在选项A中,在赋值号的左侧表示建立一个输入流对象fin,而在赋值号的右侧的表达式不正确,因为文件输入流类ifstream不能直接调用其成员函数open。
提交答案
关闭