D
David Briggs
I am using MS VC++ 6.0 with MFC
I have a simple class:
#include <fstream.h>
class Data
{
public:
CString WriteStr();
Data();
virtual ~Data();
CString Name;
};
fstream& operator<<(fstream& fs, Data& x )
{
fs << x.Name;
return fs;
};
fstream& operator>>( fstream& fs, Data& x )
{
fs >> x.Name;
return fs;
};
I have been having many problem with this. Sometime I get link errors
with just the code for operator<< and sometimes I don't. When I did get the
operator<< working I added operator>> . Now when I compiled this I get the
following error:
error C2678: binary '>>' : no operator defined which takes a left-hand
operand of type 'class fstream' (or there is no acceptable conversion)
I did try #include <fstream> and that did not work at all.
Has anyone run into this type of problem?
thanks.
I have a simple class:
#include <fstream.h>
class Data
{
public:
CString WriteStr();
Data();
virtual ~Data();
CString Name;
};
fstream& operator<<(fstream& fs, Data& x )
{
fs << x.Name;
return fs;
};
fstream& operator>>( fstream& fs, Data& x )
{
fs >> x.Name;
return fs;
};
I have been having many problem with this. Sometime I get link errors
with just the code for operator<< and sometimes I don't. When I did get the
operator<< working I added operator>> . Now when I compiled this I get the
following error:
error C2678: binary '>>' : no operator defined which takes a left-hand
operand of type 'class fstream' (or there is no acceptable conversion)
I did try #include <fstream> and that did not work at all.
Has anyone run into this type of problem?
thanks.