Re: [xml] BAD_CAST question



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 !)

HTH,
                Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]