Re: proper way to create a GString object from an unsigned char *



On Fri, Jul 23, 2004 at 12:36:28PM -0700, Adam Monsen wrote:
What's the proper way to create a GString object from an unsigned char*?

I ask because I'm using libxml, and libxml has a xmlChar type (which
is an unsigned char). If I make an xmlChar* = "Hello World", how
should I make this into a GString?

Is it wrong to just cast xmlChar* to char*, even though xmlChar is an
unsigned char?

It's OK to cast unsigned char* to signed char* and vice
versa -- if you are working with strings, that is.  If you
were doing arithmetics with the characters (i.e. using them
as small integers), then it could be different.

Yeti


--
Do not use tab characters. Their effect is not predictable.



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