开发者

libxml2 xmlChar* cast to char*

开发者 https://www.devze.com 2022-12-20 16:46 出处:网络
How would you convert / cast开发者_运维技巧 an xmlChar* to char* from the libxml2 library? Thanks.If you take a look at the examples, for instance io2.c, you\'ll notice that they just blithely cast it

How would you convert / cast开发者_运维技巧 an xmlChar* to char* from the libxml2 library? Thanks.


If you take a look at the examples, for instance io2.c, you'll notice that they just blithely cast it to a char *:

printf("%s", (char *) xmlbuff);


Looks like it's just unsigned char. So it should be safe to cast as long as you're not doing arithmetic on it.

But, you probably don't need to as that page has the key string functionality implemented in terms of the type.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号