网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
怎样打开或创建一个文件?()
- A、open()
- B、fopen()
- C、fwrite()
- D、write()
参考答案
更多 “怎样打开或创建一个文件?()A、open()B、fopen()C、fwrite()D、write()” 相关考题
考题
要打开一个已存在的非空文件“file”用于修改,选择正确的语句()
A、fp=fopen(“file“,“r“);B、fp=fopen(“file“,“w“);C、fp=fopen(“file“,“r+“);D、fp=fopen(“file“,“w+“);
考题
执行以下程序后, test.txt 文件的内容是 ( 若文件能正常打开 )#include stdio.hmain(){ FILE *fp;char *s1="Fortran",*s2="Basic";if((fp=fopen("test.txt","wb ” ))==NULL){ printf("Can't open test.txt file\n");exit(1);}fwrite(s1,7,1,fp); /* 把从地址 s1 开始的 7 个字符写到 fp 所指文件中 */fseek(fp,0L,SEEK_SET); /* 文件位置指针移到文件开头 */fwrite(s2,5,1,fp);fclose(fp);}A)BasicanB)BasicFortranC)BasicD)FortranBasic
考题
如果准备读文件,打开顺序文件"text.dat"的正确语句是A.Open "text.dat" For Write As#1B.Open "text.dar" For Binary As#1C.Open "text.dat" For Input As#1D.Open "text.dat" For Random As#1
考题
执行以下程序后,test.txt文件的内容是(若文件能正常打开)( )。includemain(){FILE*fp;c
执行以下程序后,test.txt文件的内容是(若文件能正常打开)( )。 #include<stdio.h> main() { FILE*fp; char*s1="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb"))==NULL) { printf("Can't open test.txt file\n");exit(1);} fwrite(s1,7,1,fp);/*把从地址s1开始的7个字符写到fp所指文件中*/ fseek(fp,0L,SEEK_SET);/*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp); }A.BasicanB.BasicFortranC.BasicD.FortranBasic
考题
在文件系统中,若要实现文件拷贝功能,可利用已有的系统调用,它们是A.create,open,read,write,closeB.create,open,read,write,deleteC.create,open,read,writeD.create,read,write,close
考题
(34)如果准备读文件,打开随机文件“text.dat”d的正确语句是 A.Open"text.dat"For Write As#1 B.Open"text.dat"For Binary As#1 C.Open"text.dat"For Input As#1 D.Open"text.dat"For Random As#1
考题
执行以下程序后,test.txt文件的内容是(若文件能正常打开) ()。include include
执行以下程序后,test.txt文件的内容是(若文件能正常打开) ( )。#include <stdio.h>#include <stdlib.h>main( ){ FILE * fp; char * s1 = "Fortran" , * s2 = "Basic"; if((fp = fopen( "test. txt" ," wb" )) = = NULL) { prinff( "Can't open test. txt file \n"); exit(1); } fwrite( s1 ,7,1 ,fp); /* 把从地址s1开始到7个字符写到fp所指文件中*/ fseek(fp,OL,SEEK_SET); /*文件位置指针移到文件开头*/ fwrite (s2,5,1,fp); felose (fp);}A.BasieanB.BasieFortranC.BasicD.FortranBasie
考题
以下哪种方法能保证锁在任何竞争情况下都安全?()
A.用flock()锁住指定文件B.用fopen()在系统的临时文件夹里打开文件C.用tempnam()创建一个临时文件D.用mkdir()创建一个文件夹
考题
file=open('users/yourname/desktop/file','w')file.write('helloworld!')这句代码的作用是()。
A.打开一个文件,不管文件在不在B.打开文件并写入C.在桌面上打开一个文件(路径得看个人具体情况),w的意思是,如果有则在文件里写入helloworld,如果没有则创建一个文件。D.打开文件,没有报错
考题
打开一个已经存在的非空文本文件,若文件名为stu,则正确的打开语句为( )A.FILE*fp; fp=fopen("stu.txt","r")B.FILE * fp; fp=fopen(stu.txt,r)C.FILE *fp; fP=fopen("stu,txt","wb")D.FILE *fp; fp=fopen("stu.txt",wb)
考题
如果准备读文件,打开随机文件“text.dat”的正确语句是( )。A.Open"text.dat"For Write As #1B.Open"text.dat"For Binary As #1C.Open"text.dat"For Input As #1D.Open"text.dat"For Random As #1
考题
执行以下程序后,test.txt文件的内容是(若文件能正常打开)______。 #include <stdio.h> main() { FILE *fp; char *s1="Fortran",*s2="Basic"; if((fp=fopen("test.txt","wb"))=NULL) { printf("Can't open test.txt file\n"); exit(1);} fwrite(s1,7,1,fp); /* 把从地址s1开始的7个字符写到fp所指文件中*/ f seek(fp, 0L,SEEK_SET);/*文件位置指针移到文件开头*/ fwrite(s2,5,1,fp); fclose(fp); }A.BasicanB.BasicFortranC.BasicD.FortranBasic
考题
如果准备读文件,打开随机文件“text. dat”的正确语句是( )。A.Open"text.dat" For Write As#1B.Open"text.dat"For Binary As#1C.Opcn"text.dat"For lnput As#1D.Open"text.dat"For Random As#1
考题
若需要打开一个已经存在的非空文件“file”并进行修改,则正确的打开语句是()。A、fp=fopen(“file”,“r”);B、fp=fopen(“file”,“ab+”);C、fp=fopen(“file”,“w+”);D、fp=fopen(“file”,“r+”);
考题
若需要打开一个已经存在的非空文件“FILE”,并对其进行修改,正确的打开语句是()。A、fp=fopen(“FILE”, “r+”);B、fp=fopen(“FILE”, “r”);C、fp=fopen(“FILE”, “ab+”);D、fp=fopen(“FILE”, “w+”);
考题
下列不能创建或打开一个文本文件并返回TextStran对象的方法是()A、Create TextFile方法B、Write Blank Line方法C、Open As Text Stream方法D、Open Text File方法
考题
下列说法错误的是()。A、当用Write#语句写顺序文件时,文件必须以Output或Append方式打开B、用Open语句打开一个文件时,对同一个文件可以用几个不同的文件号打开C、用Output和Append方式打开文件时,不用将文件关闭,就能重新打开文件D、用Append方式打开文件时,进行写操作,写入文件的数据附加到原来文件的后面
考题
单选题下列说法错误的是()。A
当用Write#语句写顺序文件时,文件必须以Output或Append方式打开B
用Open语句打开一个文件时,对同一个文件可以用几个不同的文件号打开C
用Output和Append方式打开文件时,不用将文件关闭,就能重新打开文件D
用Append方式打开文件时,进行写操作,写入文件的数据附加到原来文件的后面
考题
单选题若需要打开一个已经存在的非空文件“FILE”,并对其进行修改,正确的打开语句是()。A
fp=fopen(“FILE”, “r+”);B
fp=fopen(“FILE”, “r”);C
fp=fopen(“FILE”, “ab+”);D
fp=fopen(“FILE”, “w+”);
考题
单选题以下哪种方法能保证锁在任何竞争情况下都安全?()A
用flock()锁住指定文件B
用fopen()在系统的临时文件夹里打开文件C
用tempnam()创建一个临时文件D
用mkdir()创建一个文件夹
考题
单选题若需要打开一个已经存在的非空文件“file”并进行修改,则正确的打开语句是()。A
fp=fopen(“file”,“r”);B
fp=fopen(“file”,“ab+”);C
fp=fopen(“file”,“w+”);D
fp=fopen(“file”,“r+”);
热门标签
最新试卷
![瑞牛题库 章节练习 历年真题 模拟试卷](http://assets.51tk.com/51_sidebar_right_index.jpg)