要打开一个已存在的非空文件file.txt用于修改,正确的语句应为( )。
A: fp = fopen("file.txt","w" );
B: fp = fopen("file.txt", "w+" );
C: fp = fopen("file.txt", "r" );
D: fp = fopen("file.txt", "r+" );
A: fp = fopen("file.txt","w" );
B: fp = fopen("file.txt", "w+" );
C: fp = fopen("file.txt", "r" );
D: fp = fopen("file.txt", "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+");
- 要打开一个已存在的非空二进制文件“file”用于修改,选择正确的语句是( ) A: fp=fopen("file","rb"); B: fp=fopen("file","ab+"); C: fp=fopen("file","wb"); D: fp=fopen("file","rb+");
- 定义fp为文件型指针变量,使用fopen只读方式打开一个已存在的二进制文件,以下正确的调用形式为: A: fp=fopen("my.dat", "r"); B: fp=fopen("my.dat", "rb+"); C: fp=fopen("my.dat", "rb"); D: fp=fopen("my.dat", "r+");
- 以二进制只读方式打开一个已有的文本文件file1,正确调用fopen函数的方式是( ) A: fp=fopen("file1","rb"); B: fp=fopen("file1","r+"); C: fp=fopen("file1","rb+"); D: fp=fopen("file1","r");
- 以写方式打开myfile.txt文本文件,正确的选项是()。 A: fopen("myfile.txt","r"); B: fopen("myfile.txt","w"); C: fopen("myfile.txt","rb"); D: fopen("myfile.txt","wb");