On Wed, 19 May 2004, Imran A R (RBIN/EDM1) * wrote:
>
>       can you please send me some samples of this ostream method?

struct MyStruct {
    int SomeInt;
    std::string SomeString;
};

std::ostream& operator<<( std::ostream& os, MyStruct const& ms ) {
    os << "<MyStruct SomeInt='" << ms.SomeInt
       << "' SomeString='" << ms.SomeString
       << "'/>";
    return os;
}

This does not do any XML encoding of the contents of SomeString (ie.
convert '&' to '&amp;' and such), but it's a start.


Sean

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to