简体   繁体   中英

libxml2 xmlChar* cast to char*

How would you convert / cast an xmlChar* to char* from the libxml2 library? Thanks.

如果您看一下示例,例如io2.c,您会注意到它们只是巧妙地将它转换为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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM