Using LIBXML2
Get the contents of a node:
Xmlchar *value = xmlnodegetcontent (node)
1. Convert Xmlchar into Char
char * stream = (char *) value;
2, Char * and int conversion
int x = atoi (stream);
#include "stdio.h" #include "stdlib.h" main () {char *p= "1234567"; int x; X=atoi (P);//Turn into shaping printf ("%d\n", x);} If the landlord is written char*p= "1234.567" is X=atof (p); C Language Library function name: atoi Function: Converts a string to an integer number. Name Source: an abbreviation for array to integer. Function Description: Atoi () scans the parameter nptr string, if the first character is not a number and is not the sign returns zero, otherwise the type conversion is started, then a non-numeric or terminator is detected to stop the conversion, returning the integer number. prototype: int atoi (const char *nptr); Header files needed: #include <stdlib.h> atof is the conversion of strings to floating-point numbers
3, Char * and float conversion
char * p = "1234.567";
int x = Atof (p);
4, int and portnumbits conversion
int a = 554;
Portnumbits n = (portnumbits) A
Type conversion in C + + Xmlchar * with char * conversion, char * with int conversion, char * with float conversion, int vs. portnumbits conversion