1、数组操作
#include <iostream> #include <winsock2.h> #include <windows.h> #include <xmlrpc-c/base.hpp> #include <xmlrpc-c/registry.hpp> #include <xmlrpc-c/server_abyss.hpp> #include <direct.h> #include <stdio.h> #include <stdlib.h> int main() { xmlrpc_env env; xmlrpc_env_init(&env); xmlrpc_value* myArrayP = xmlrpc_build_value(&env, "(iis)", 5, 7,"abc");
xmlrpc_value* firstElementP; xmlrpc_value* secondElementP; xmlrpc_value* thirdElementP; xmlrpc_int firstInt; xmlrpc_int secondInt; const char* thirdStr; printf("Array has %u elements\n", xmlrpc_array_size(&env, myArrayP)); xmlrpc_array_read_item(&env, myArrayP, 0, &firstElementP); xmlrpc_array_read_item(&env, myArrayP, 1, &secondElementP); xmlrpc_array_read_item(&env, myArrayP, 2, &thirdElementP); xmlrpc_read_int(&env, firstElementP, &firstInt); xmlrpc_read_int(&env, secondElementP, &secondInt); xmlrpc_read_string(&env, thirdElementP, &thirdStr); printf("First element is %d\n", firstInt); printf("Second element is %d\n", secondInt); printf("Third element is %s\n", thirdStr); system("pause"); }
2、结构体操作
#include <iostream> #include <winsock2.h> #include <windows.h> #include <xmlrpc-c/base.hpp> #include <xmlrpc-c/registry.hpp> #include <xmlrpc-c/server_abyss.hpp> #include <direct.h> #include <stdio.h> #include <stdlib.h> int main() { xmlrpc_env env; xmlrpc_env_init(&env); xmlrpc_value *myStructP = xmlrpc_build_value(&env, "{s:i}", "age", 32); xmlrpc_value * ageP; xmlrpc_struct_find_value(&env, myStructP, "age", &ageP); if (ageP) { xmlrpc_int age; xmlrpc_read_int(&env, ageP, &age); printf("age is %d\n", age); } else printf("There is no member named 'age'"); system("pause"); }
标签:组合,xmlrpc,int,value,read,env,XmlRPC,include,入门 From: https://www.cnblogs.com/missyou0813/p/17867716.html