打开一个二进制输出文件test.dat,下列语句中错误的是()。
A: ofstreamfout; fout.open(“test.dat”);
B: ofstreamfout; fout.open(“test.dat”,ios::binary);
C: ofstreamfout(“test.dat”,ios::binary);
D: ofstream*p=newofstream(“test.dat”,ios::binary);
A: ofstreamfout; fout.open(“test.dat”);
B: ofstreamfout; fout.open(“test.dat”,ios::binary);
C: ofstreamfout(“test.dat”,ios::binary);
D: ofstream*p=newofstream(“test.dat”,ios::binary);
举一反三
- 打开一个二进制输出文件“test.dat”,下列语句中错误的是( )。? ofstream fout;; fout.open( “test.dat”, ios::binary );|ofstream fout;; fout.open( “test.dat” );|ofstream *p = new ofstream( “test.dat”, ios::binary );|ofstream fout( “test.dat”, ios::binary );
- 要求打开文件test.dat,可读出数据,正确的语句是 A: ifstream myFile(“test.dat”, ios::in); B: fstream myFile (“test.dat”, ios::in); C: ifstream myFile; myFile.open(“test.dat”, ios::in); D: 以上都正确
- 用open()函数以二进制读方式打开文件时,打开方式应设置为: A: ios::out|ios::binary B: ios::out|ios::in C: ios::app|ios::binary D: ios::in|ios::binary
- 若打开二进制文件,读取数据,正确的fopen函数调用方式是 A: fopen("test.dat","rb") B: fopen("test.dat","wb") C: fopen("test.dat","w") D: fopen("test.dat","a")
- 若要打开指定的c盘子目录B130104下二进制文件test.dat文件,在调用函数fopen时,第一个参数的正确格式是________。 A: "c: B130104\test.dat" B: "c:\ B130104\\test.dat" C: "c:\\ B130104\\test.dat" D: "c:\ B130104\test.dat"