读书人

ifstream, Ofstream打开的文件怎么关闭

发布时间: 2012-02-06 15:52:44 作者: rapoo

ifstream, Ofstream打开的文件如何关闭?
ifstream, Ofstream打开的文件如何关闭?

[解决办法]
Interface

template <class charT, class traits = char_traits <charT> >
class basic_ifstream
: public basic_istream <charT, traits> {
public:
typedef basic_ios <charT, traits> ios_type;
typedef traits traits_type;
typedef charT char_type;
typedef typename traits::int_type int_type;
typedef typename traits::pos_type pos_type;
typedef typename traits::off_type off_type;
basic_ifstream();

explicit basic_ifstream(const char *s,

ios_base::openmode mode =
ios_base::in,
long protection = 0666);
explicit basic_ifstream(int fd);
basic_ifstream(int fd, char_type* buf, int len);
virtual ~basic_ifstream();
basic_filebuf <charT, traits> *rdbuf() const;
bool is_open();
void open(const char *s, ios_base::openmode mode =
ios_base::in, long protection = 0666);
void close();
};

调用close()方法关闭

读书人网 >C++ Builder

热点推荐