|
Boost : |
From: Adrian Michel (michel_at_[hidden])
Date: 2003-09-17 09:08:00
> -----Original Message-----
> From: Ehsan Akhgari [mailto:ehsan_at_[hidden]]
> Sent: Wednesday, September 17, 2003 1:41 AM
> To: 'Boost mailing list'
> Subject: RE: [boost] Unicode and filesystem
>
>
> > This constructor for the class std::fstream is documented in the help,
>
> > but it doesn't seem to be actually implemented. Any idea what's going
> > on? I am using VC++ 6.0.
>
> Try compiling the following:
>
> #include <fstream>
> #include <tchar.h>
>
> int main()
> {
> std::basic_fstream< TCHAR > stream(
> _tfopen( _T("myfile.txt"), _T("r") ) );
> }
>
The std::basic_fstream does not have this constructor, and the code does not
compile. Again, I am using VC++ 6.
Here is std::basic_fstream from my <fstream> :
template<class _E, class _Tr = char_traits<_E> >
class basic_fstream : public basic_iostream<_E, _Tr> {
public:
basic_fstream()
: basic_iostream<_E, _Tr>(&_Fb) {}
explicit basic_fstream(const char *_S,
ios_base::openmode _M = in | out)
: basic_iostream<_E, _Tr>(&_Fb)
{if (_Fb.open(_S, _M) == 0)
setstate(failbit); }
virtual ~basic_fstream()
{}
basic_filebuf<_E, _Tr> *rdbuf() const
{return ((basic_filebuf<_E, _Tr> *)&_Fb); }
bool is_open() const
{return (_Fb.is_open()); }
void open(const char *_S, ios_base::openmode _M = in | out)
{if (_Fb.open(_S, _M) == 0)
setstate(failbit); }
void open(const char *_S, ios_base::open_mode _M)
{open(_S, (openmode)_M); }
void close()
{if (_Fb.close() == 0)
setstate(failbit); }
private:
basic_filebuf<_E, _Tr> _Fb;
};
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk