Sign-up....

急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

#include <iostream>

using namespace std;

int main()

{

ofstream outfile;

outfile.open("abc.dat",ios::out);

return 0;

}

--------------------Configuration: p39 - Win32 Debug--------------------

Compiling...

p38.cpp

C:\Program Files\Microsoft Visual Studio\MyProjects\p39\p38.cpp(5) : error C2079: 'outfile' uses undefined class 'basic_ofstream<char,struct std::char_traits<char> >'

C:\Program Files\Microsoft Visual Studio\MyProjects\p39\p38.cpp(6) : error C2228: left of '.open' must have class/struct/union type

Error executing cl.exe.

[567 byte] By [msdn] at [2007-8-14 13:07:50]
# 1 Re: 急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

#include <fstream>

darkstar21cn at 2004-9-26 9:36:35 >
# 2 Re: 急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

谢谢,通过了,

但fstream 不是iostream 的继承类吗?

有了#include <iostream> 还要#include <fstream>?

dreamboy1123 at 2004-9-26 9:39:11 >
# 3 Re: 急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

楼主说得很对啊,

正是因为这个继承关系,才不能仅仅包含<iostream>.

iostream可以作的, fstream都可以作;

fstream可以作的, iostream不一定可以作.

redolive at 2004-9-26 11:39:21 >
# 4 Re: 急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

晕,自己都说事fstream继承iostream了,还。。。。。。

boyate at 2004-9-27 14:51:23 >
# 5 Re: 急,高手快帮帮我,在钱等!!! 编译通不过,不知是为什么,谢谢帮助 !!!1

对不起,刚才脑子有点短路 :)

dreamboy1123 at 2004-9-29 20:59:47 >

C/C++

All Classified