如果想从文件D:\test.txt读取或再写入一些数据,正确的打开文件的语句是()。
A: fp = open("D:\\test.txt", "r+")
B: fp = open("D:\\test.txt", "w+")
C: fp = open("D:\\test.txt", "x+")
D: fp = open("D:\\test.txt", "rw")
A: fp = open("D:\\test.txt", "r+")
B: fp = open("D:\\test.txt", "w+")
C: fp = open("D:\\test.txt", "x+")
D: fp = open("D:\\test.txt", "rw")
举一反三
- 在以下open语句中哪一项无法对文件test.txt进行内容删除或修改?? fp;=;open('test.txt',;'w')|fp;=;open('test.txt',;'r')|fp;=;open('test.txt',;'a')|fp;=;open('test.txt',;'r+')
- 在Windows 10中,E盘根目录中文件夹"12"里的记事本文件"TEST"的完整路径和文件名为( )。 A: E:\12\TEST.TXT B: E:\12\TEST\TXT C: E:/12/TEST.TXT D: E:\12\TEST
- 已知,文件D:\test.txt的内容为:1234567890则执行下列语句后,test.txt的内容为( )。fp=open("d:\\test.txt", "r+")fp.seek(3,0)lst=['a', 'b', 'c']fp.writelines(lst) A: abc4567890 B: 123abc7890 C: 1234567abc D: 1234567890abc
- 以下程序执行后,文件test.txt的内容是() #include void main() { FILE *fp; fp=fopen(“test.txt”,”w”); fprintf(fp,”%s”,”How ”); fclose(fp); fp=fopen(test.txt“,”a”); fprintf(fp,”%s”,”are you!”); fclose(fp); }
- 若有定义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');