• 2022-06-26
    若要将数据添加到一个文件名为“C:\T1.txt”的文本文件,则应使用下列________程序段打开文件。
    A: s=r"C:\T1.txt"
    fp=open(s,"a")
    B: s = "C:\T1.txt"
    fp=open("s","a")
    C: fp=open("C:\T1.txt","a")
    D: fp=open(C:\\T1.txt, "a")
  • A

    举一反三

    内容

    • 0

      若要从磁盘上读一个文件名为“C:\T1.txt”的顺序文件,则应使用下列________程序段打开文件 A: Dim F As StringF = "C:\T1.txt"FileOpen(1, F, OpenMode.Input) B: Dim F As StringF = "C:\T1.txt"FileOpen(1, "F", OpenMode.Input) C: FileOpen(1, "C:\T1.txt", OpenMode.Output) D: FileOpen(1, C:\T1.txt, OpenMode.Input)

    • 1

      要从磁盘上新建一个名为"c:\t1.txt"的顺序文件,如下语句中正确的是(). A: F="c:\t1.txt" Open "F" For Append As B: 2 C: F="c:\t1.txt" Open "F" For Output As D: 2 E: Open c:\t1.txt For Output As F: 2 G: Open "c:\t1.txt" For Output As H: 2

    • 2

      若要在磁盘上新建一个文件名为"C:T1.txt"顺序文件,则应用下列________程序段。 A: FileOpen(1,"C:T1.txt",OpenMode.Output) B: DimstrFileNameAsStringstrFileName="C:T1.txt"FileOpen(1,"strFileName",OpenMode.Input) C: FileOpen(1,C:T1.txt,OpenMode.Input) D: DimstrFileNameAsStringstrFileName="C:T1.txt"FileOpen(1,"strFileName",OpenMode.Output) E: FileOpen(1,C:T1.txt,OpenMode.Output)

    • 3

      执行以下程序后,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: Basiean B: BasieFortran C: Basic D: FortranBasie

    • 4

      若要在磁盘上新建一个文件名为"C:\T1.txt"顺序文件,则应用下列________程序段。 A: FileOpen(1,"C:\T1.txt",OpenMode.Output) B: Dim strFileName As StringstrFileName = "C:\T1.txt"FileOpen(1,"strFileName",OpenMode.Input) C: FileOpen(1,C:\T1.txt,OpenMode.Input) D: Dim strFileName As StringstrFileName = "C:\T1.txt"FileOpen(1,"strFileName",OpenMode.Output) E: FileOpen(1,C:\T1.txt,OpenMode.Output)