Re: [xml] BAD_CAST question
- From: Stefan Seefeld <seefeld sympatico ca>
- To: Clint Barlow <ceilingzero gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] BAD_CAST question
- Date: Fri, 08 Dec 2006 14:50:44 -0500
Clint Barlow wrote:
Hi, I have a function that returns a std::string that I need to convert
to an xmlChar*. What is the best way to do this? I get a compiler
error when I use the BAD_CAST macro. I'm fairly new to to C and
libxml. Thanks for your help.
To extract a 'char const *' from a std::string you have to call its c_str()
method. That you can cast using BAD_CAST. (But make sure it gets appropriately
copied, depending on where you us it !)
...ich hab' noch einen Koffer in Berlin...
] [Thread Prev