On Fri, 2002-01-18 at 05:24, Xerces Rule wrote: > Hi all. > > Thank you, Michael.
You're welcome > using namespace MCLib; > DOM_Node Attribute; > char *AttrValue; > AttrValue = DOMStringToStdString( Attribute.getNodeValue() > ); > -----------------//------------- > > But I get this error message: > ********* > error C2679: binary '=' : no operator defined which takes a > right-hand operand > of type 'class std::basic_string<char,struct > std::char_traits<char>,class > std::allocator<char> >' (or there is no acceptable > conversion) you need to do this instead: using std::string string AttrValue; AttrValue = DomStringToStdString( Attribute.getNodeValue() ); or preferably: string AttrValue( DomStringToStdString( Attribute.getNodeValue() ); string is a class provided by the C++ standard template library. It is meant to be a container for test strings, like what you normally do with char *'s, but without problems of pointer errors or buffer overflows or memory leaks - just what you really want to do. It is defined in #include <string>, and is a typedef for basic_string, which is a template. There are other things you can do with basic_string, like get multibyte characters. You can combine the use of std::string and traditional C-style char *'s. string::c_str() returns a char* pointing into the string's text. You can construct a std::string from a char*: char *cStr = "hello"; std::string myString( cStr ); Mike -- Michael D. Crawford GoingWare Inc. - Expert Software Development and Consulting [EMAIL PROTECTED] http://www.goingware.com/ Tilting at Windmills for a Better Tomorrow. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
