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()方法关闭