网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
当已存在一个abc.txt文件时,该语句myfile=open("abc.txt","w")的功能是______。
参考答案和解析
fopen(“abc.txt”,”r+”);
更多 “当已存在一个abc.txt文件时,该语句myfile=open("abc.txt","w")的功能是______。” 相关考题
考题
下列语句用于打开一个顺序文件Open"C:\MyFile.txt"For OutPut,但该语句的一个重要错误是没有( )。A.指定打开方式B.指定文件号C.指定打开文件名D.指定文件类型
考题
设有语句: Open"C:\Test. Dat" For Output As #1 则以下错误的叙述是:A.该语句打开C盘根目录下一个已存在的文件Test. DatB.该语句在C盘根目录下建立一个名为Test. Dat的文件C.该语句建立的文件的文件号为1D.执行该语句后,就可以通过Print#语句向文件Test. Dat中写入信息
考题
下列打开文件的表达式中,错误的是( )。A.ofstream ofile;ofile.open("C:\\vc\LabC.txt",ios::binary);B.fstream iofile;iofile.open("abC.txt",ios::ate);C.ifstream ifile("C:\\vc\abC.txt");D.cout.open("C:\\vc\abC.txt",ios::binary);
考题
以下程序试图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符#时结束输入和输出操作,但程序有错。 #include<stdio.h> main() { FILE *fout; char ch; fout=fopen('abc.txt','W'); ch=fgetc(stdin); while (ch!='#') { fputc (ch,fout); ch=fgetc(stdin); } fclose (fout); } 出错的原因是( )。A.函数fopen调用形式错误B.输入文件没有关闭C.函数fgetc调用形式错误D.文件指针stdin没有定义
考题
下面程序的预设功能是:统计文件abc.txt中的字符个数。 include include
下面程序的预设功能是:统计文件abc.txt中的字符个数。include <iostream.h>include <fstream.h>include <stdlib.h>void main(){fstream file;file.open( "abc.txt", ios::in);if ( !file ){cout<<"Can not open abc.txt"<<end1;abort();}char ch;int i = O;while (______________){file.get(ch);i++;}cout<<"Characters : "<<i<<end1;file.close();}则程序中空白处应该填入的语句是【 】。
考题
(34)设有语句Open"C:\Test.Dat"For OutPut As#1,则下列叙述错误的是 A.该语句只能打开C盘根目录下一个已存在的文件Test.DatB.当C盘根目录下没有该文件时,该语句在C盘根目录下建立名为Test.Dat的文件C.该语句建立文件的文件号为1D.执行该语句后,就可以通过Pint#语句向Test.Dat文件中写入信息
考题
有以下程序:includeincludeusing namespace std;int main(){fstream file;fi
有以下程序:include<iostream>include<fstream>using namespace std;int main(){fstream file;file.open("abc.txt", ios :: in);if ( !file ){cout<<"Can not open abc.txt"<<end1;abort();}char buf[ 80 ];int i = 0;while (!file.eof()){file.getline(buf,80);i++;}cout<<"Lines :"<<i<<end1;file.close();return 0;}程序实现的功能是【 】。
考题
下列打开文件的表达式中,错误的是( )。A.ofstream ofile; ofile.open("C:\\vc\\abc.txt",ios: :binary);B.fstream iofile; iofile.open("abc.txt",ios::ate);C.ifstream ifile("C:\\vc\\abc.txt");D.cout.open("C:\\vc\\abc.txt",ios: :binary);
考题
设有语句Open"C:\Test.Dat"For OutPut As#1,则下列叙述错误的是( )。A.该语句只能打开C盘根目录下一个已存在的文件Test.DatB.当C盘根目录下没有该文件时,该语句在C盘根目录下建立名为Test.Dat的文件C.该语句建立文件的文件号为1D.执行该语句后,就可以通过Print#语句向Test.Dar文件中写入信息
考题
下列打开文件的表达式中,错误的是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);
考题
以下不能正确创建输出文件对象并使其与磁盘文件相关联的语句是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");
考题
以下程序企图把从键盘终端输入的字符输出到名为abc.txt的文件中,当从终端读到字符'#'时,结束输入和输出操作。但该程序有错。 #include <iostream> #include <fstream> using namespace std; int main() { ofstream ofile; char ch; ofile.open("d:\\abc.txt", 'W'); do{ cin>>ch; ofile.put(ch); }while(ch!='#'); ofile.close(); return 0; } 程序出错的原因是( )。A.成员函数open调用形式错误B.输入文件没有关闭C.成员函数put调用形式错误D.对象ofile定义错误
考题
以下不能正确创建输出文件对黎并使其与磁盘文件相关联的语句是( )。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");
考题
若要打开A盘上user了目录下名为abc.txt的文本文件进行读、写操作,下面符合此要求的函数调用是A.fopen("A:\user\abc.txt",","r")B.fopen("A:\\user\\abc.txt","r+")C.fopen("A:\user\abc.txt","rb")D.fopen("A:\\user\\abc.txt","w")
考题
当需要打开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);
考题
在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。 A、BufferedReader breader=new BufferedReader(new FileReader("abc.txt"));B、PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);C、FileInputStream fin = new FileInputStream(“abc.txt”);D、OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
考题
已知文本文件abc.txt,以读方式打开,下列的操作中错误的是()。A、fstreaminfile("abc.txt",ios::in)B、ifstreaminfile("abc.txt")C、ofstreaminfile("abc.txt")D、fstreaminfile;infile.open("abc.txt",ios::in)
考题
下列打开文件的表达式中,()是错误的。A、ofstream ofile;ofile.open("abc.txt",ios::binary);B、fstream iofile;iofile.open("abc.txt",ios::ate);C、ifstream ifile("abc.txt");D、cout.open("abc.txt",ios::binary);
考题
若要打开:A盘上user子目录下名为abc.txt的文本文件进行读、写操作,下面符合此要求的函数调用是()。A、fopen("A://user//abc.txt","r")B、fopen("A://user//abc.txt","r+")C、fopen("A://user//abc.txt","rb")D、fopen("A://userl//abc.txt","w")
考题
单选题以下语句用于打开一个顺序文件“Open ″C:\MyFile.txt″ For OutPut”,但是该语句的一个重要错误是没有( )。A
指定打开方式B
指定文件号C
指定打开文件名D
指定文件类型
考题
单选题若要打开A盘上user子目录下名为abc.txt的文本文件进行读、写操作,下面符合此要求的函数调用是()。A
fopen("A:/user/abC.txt","r")B
fopen("A://user//abC.txt","r+")C
fopen("A:/user/abC.txt","rb")D
D.fopen("A://user//abtxt","w")
考题
单选题下列打开文件的表达式中,()是错误的。A
ofstream ofile;ofile.open(abc.txt,ios::binary);B
fstream iofile;iofile.open(abc.txt,ios::ate);C
ifstream ifile(abc.txt);D
cout.open(abc.txt,ios::binary);
热门标签
最新试卷