定义fp为文件型指针变量,以读写方式打开一个已存在的文本文件test.dat,下面fopen函数正确的调用方式是:
A: FILE *fp; fp=fopen("test.dat", "rb");
B: FILE*fp; fp=fopen("test.dat", "r+");
C: FILE *fp; fp=fopen("test.dat", "r");
D: FILE *fp; fp=fopen("test.dat", "rb+");
A: FILE *fp; fp=fopen("test.dat", "rb");
B: FILE*fp; fp=fopen("test.dat", "r+");
C: FILE *fp; fp=fopen("test.dat", "r");
D: FILE *fp; fp=fopen("test.dat", "rb+");
举一反三
- 以读写方式打开一个已存在的文本文件test.dat,可以使用 FILE *fp; fp=fopen("test.dat","r+");
- 定义fp为文件型指针变量,以读写方式打开一个已存在的文本文件test.dat,下面fopen函数正确的调用方式是: A: FILE *fp; fp=fopen("test.dat", "rb"); B: FILE*fp; fp=fopen("test.dat", "r+"); C: FILE *fp; fp=fopen("test.dat", "r"); D: FILE *fp; fp=fopen("test.dat", "rb+");
- 以二进制只读方式打开一个已有的文本文件file1,正确调用fopen函数的方式是() A: FILE*fp;fp=fopen("file1","rb"); B: FILE*fp;fp=fopen("file1","r+"); C: FILE*fp;fp=fopen("file1","r"); D: FILE*fp;fp=fopen("file1","rb+");
- 若有定义FILE *fp; 以“只读”方式打开文件C:\test\myfile.txt的正确语句是 A: fp = fopen("C:\test\myfile.txt","r"); B: fp = fopen("C:\\test\\myfile.txt","r"); C: fp = fopen("C:\test\myfile.txt",'r'); D: fp = fopen("C:\\test\\myfile.txt",'r');
- 以只读方式打开一个已有的文本文件file1.txt,下面有关fopen函数正确的调用方式为________。 A: FILE *fp;fp=fopen("file1.txt","w"); B: FILE *fp;fp=fopen("file1.txt","r"); C: FILE *fp;fp=fopen("file1.txt","r+"); D: FILE *fp;fp=fopen("file1.txt","rb+");