以下不能正确创建输出文件对象并使其与磁盘文件相关联的语句是( )。
A.ofstream myfile;mynle.open(“d:ofile.txt”);
B.ofstream * mynle=new ofstream;mynle->open(“d:Ofile.txt”);
C.ofstream myhle(“d:ofile.txt”);
D.ofstream * mynle=new(“d:ofile.txt”);
第1题:
判断一个ofstream类对象file打开文件是否失败,应该判断()
A、创建文件流对象时是否抛出异常
B、open成员函数的返回值
C、feof成员函数的返回值
D、!file是否为真
第2题:
若磁盘上已存全路径文件名为c:\ctest\test.txt的文件,下面语句中不能打开该文件的是( )。
A.ifstream *pFile=new ifstream("c:\\ctest\\test.txt");
B.ifstream file("c:\\ctest\\test.txt");
C.ifstream file;file.open("c:\\ctest\\test.txt");
D.ifstream file("c:\etest\test.txt");
第3题:
若目前D盘根目录下并不存在test.txt文件,则下列打开文件方式不会自动创建test,txt文件的是( )。
A.ifstreamfin;fin.open("d:\\test.txt",iso_base::in);
B.fstreamfi0;ri0.open("d:\\test.txt",is0_base::out);
C.ofstream。fort;lout.open("d:\\test.txt",ios_base::out);
D.ofstreamfout;fout.open("d:\\test.txt",is0_base::app);
第4题:
阅读以下程序# include<fstream. h>void main(){ifstream infile;ofstream outfile;{stream iofile;iofile. open("a. txt", ios:: in);iofile. close();iofile. open('b. txt" ,ios: :out):....}下列描述错误的是
A.对象infile只能用于文件输入操作
B.对象outfile只能用于文件输出操作
C.对象iofile在文件关闭后,不能再打开另一个文件
D.对象iofile可以打开一个文件同时进行输入和输出
第5题:
若磁盘上已存在某个文本文件,其全路径文件名为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");
第6题:
当需要打开A盘上的abc.txt 文件用于输入时,则定义文件流对象的语句为______ 。
A.fstream fin(“A: abc.txt”);
B.ofstream fin (“A: abc.txt”);
C.ifstream fin(“A: abc.txt”,ios:: app);
D.ifstream fin(“A: abc.txt”,ios:: nocreate);
第7题:
列声明并创建Connection对象的语句,正确的是()。
ADim ADOcn As New Connection
BDim ADOcn As Connection
CDeclare ADOcn As New Connection
DDeclare ADOcn As Connection
第8题:
以下不能正确创建输出文件对象并使其与磁盘文件相关联的语句是()。
第9题:
某程序将计算结果输出到一个有格式顺序文件中,文件名为AA.DAT,设备通道号为3,打开这个文件的语句是:()
第10题:
ifstream fin=ifstream.open(“file.dat”);
ifstream* fin=new ifstream(“file.dat”);
ifstream fin; fin.open(“file.dat”);
ifstream* fin=new ifstream(); fin->open(“file.dat”);
第11题:
OPEN(UNIT=3,FILE=AA.DAT,STATUS=NEW)
B.OPEN(UNIT=3,FILE=ADAT,STATUS=OLD.
C.OPEN(3,FILE=′ADAT′,STATUS=′NEW′)
D.OPEN(D,FILE=′ADAT′,STATUS=′OLD′)
第12题:
ofstream myfile;myfile.open(d:ofile.txt);
ofstream *myfile=new ofstream;myfile->open(d:ofile.txt);
ofstream myfile(d:ofile.txt);
ofstream *myfile=new(d:ofile.txt);
第13题:
下列打开文件的表达式中,错误的是
A.ofstream ofile;ofile.open("C:\\vc\\abc.txt",ios::binary);
B.fstream iofile;iofile.open("abc.txt",ios::ate);
C.ifstream ifile("C:\\vcXXabc.txt");
D.cout.open("C:\\vc\\abc.txt",ios::binary);
第14题:
以下不能正确创建输出文件对象并使其与磁盘文件相关联的语句是
A.ofstream myfile:myfile, open("d:ofile.txt");
B.ofstream *myfile=new ofstream;myfile->open("d;ofile.txt");
C.ofstream myfile("d:ofile.txt");
D.ofstream *myfile=new ("d:ofile.txt");
第15题:
以下不能正确创建输出文件对黎并使其与磁盘文件相关联的语句是( )。
A.ofstreammyfile;myfile.open("d:ofile.txt");
B.ofstream*myfile=newofstream;myfile->open("d:ofile.txt”);
C.ofstreammyfile("d:ofile.txt");
D.ofstream*myfile=new("d:ofile.txt");
第16题:
以下不能正确创建输出文件对象并使其与磁盘文件相关联的语句组的选项是 ( )。
A.ofstream cfile; cfile.open( "d : ofile.txt" );
B.ofstream * cfile = new ofstream; cfile -> open( "d : ofile.txt );
C.ofstream cfile( "d: ofile.txt" );
D.ofstream * cfile = new( "d : ofile.txt" )
第17题:
下列打开文件的表达式中,错误的是( )。
A.ofstream ofile;ofile.open("C:\\vc\\a.txt",ios::binary);
B.fstream iofile;iofile.open("a.txt",ios::ate);
C.ifstream ifile("C:\\vc\\a.txt");
D.cout.open("C:\\vc\\s.txt",ios::binary);
第18题:
以下语句用于打开一个顺序文件Open"C:\MyFile.txt"For OutPut 但该语句的一个重要错误是没有 ______。
A.指定打开方式
B.指定文件号
C.指定打开文件名
D.指定文件类型
第19题:
设要把一个文件输出流对象myFile与文件“f:\myText.txt相关联,所用的C++语句是:()。
第20题:
创建一个向文件“file.txt”追加内容的输出流对象的语句有()。
第21题:
指定打开方式
指定文件号
指定打开文件名
指定文件类型
第22题:
第23题:
FileOutputStream out=new FileOutputStream(“file.txt”,true);
OutputStream out=new FileOutputStream(“file.txt”,“append”);
OutputStream out=new FileOutputStream(“file.txt”);
FileOutputStream out=new FileOutputStream(new file(“file.txt”));
OutputStream out=new FileOutputStream(new File(“file.txt”),true.;