S
Suman
Hello All,
Given a structure:
struct s {
char *name;
wchar_t *surname;
};
I wish to define a friend function for the above struct:
std:
stream& operator<<(std:
stream& out, const s& x);
or whatever suitable stream it should take, which would
print both members.So I can write stuff like:
s my_struct;
// fill it up
....
std::cout << my_struct;
AFAIK wchar_t requires wostream. Which is the root of
the problem. I can definitely convert the wchar_t stuff to some
multibyte char sequence and go through ostream. Does a
better alternative exist?
Regards,
Suman.
Given a structure:
struct s {
char *name;
wchar_t *surname;
};
I wish to define a friend function for the above struct:
std:
or whatever suitable stream it should take, which would
print both members.So I can write stuff like:
s my_struct;
// fill it up
....
std::cout << my_struct;
AFAIK wchar_t requires wostream. Which is the root of
the problem. I can definitely convert the wchar_t stuff to some
multibyte char sequence and go through ostream. Does a
better alternative exist?
Regards,
Suman.