niusouti.com

若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt ,下列语句中不 能打开该文件的是A . ifstream file("d:\ncre\test.txt") ;B . ifstream file("d:\ncre\test.txt");C . ifstream file; file.open("d:\ncre\test.txt");D . ifstream* pFile=new ifstream("d:\ncre\test.txt");

题目

若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt ,下列语句中不 能打开该文件的是

A . ifstream file("d:\ncre\test.txt") ;

B . ifstream file("d:\ncre\test.txt");

C . ifstream file; file.open("d:\ncre\test.txt");

D . ifstream* pFile=new ifstream("d:\ncre\test.txt");


相似考题
更多“若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt ,下列语句中不 能打开该文 ”相关问题
  • 第1题:

    若磁盘上已存在某个文本文件,其全路径文件名为d:\ncre\test.txt,下列语句中不能打开该文件的是

    A.ifstream file("d:\ncre\test.txt");

    B.ifstream file("d:\\ncre\\test.txt");

    C.ifstream file;file.open("d:\\ncre\\test.txt");

    D.ifstream* pFile=new ifstream("d:\\ncre\\test.txt");


    正确答案:A
    解析:本题考查的知识点是转义字符。在C++的字符常量或字符串中,以“\”开头的一系列字符被看作一个特殊的字符,即转义字符。要表示'\'字符时,必须使用转义字符'\\'。故本题应该选择A。

  • 第2题:

    某网站主页地址为http://ncre.eduexam.cn/weboot/,打开网页,浏览“网络课堂”页面信息,查找“二级C语言”页面内容,将它以文本文件的格式保存在指定目录下,命名为IE18.txt。


    正确答案:

  • 第3题:

    当已存在一个test.txt文件时,执行函数fopen("test.txt","r+")的功能是()。

    A.打开test.txt文件,覆盖原有的内容

    B.打开test.txt文件,可以读取和写入新的内容

    C.打开test.txt文件,只能写入数据,但不能读取数据

    D.打开test.txt文件,只能读取原有内容,但不能写数据


    打开abc.txt文件,可以读取和写入新的内容

  • 第4题:

    若磁盘上已存在某个文本文件,其全路径文件名为d:\shiti\tes.txt,下列语句中不能打开该文件的是( )。

    A.ifstream file("d:\shiti\test.txt");

    B.ifstream file("d:\\shiti\\test.txt");

    C.ifstream file;file.open("d:\\shiti\\test.txt");

    D.ifstream* pFile = new ifstream("d:\\shiti\\test.txt");


    正确答案:A

  • 第5题:

    以“w”方式打开文本文件a:aa.dat,若该文件已存在,则()。

    A.新写入数据被追加到文件末尾

    B.文件被清空,从文件头开始存放新写入数据

    C.显示出错信息

    D.新写入数据被插入到文件首部


    文件被清空,从文件头开始存放新写入数据