获取64位整数属性 - XmlGetAttributeInt64
函数简介
获取元素的64位整数类型属性值。
接口名称
XmlGetAttributeInt64
DLL调用
int64_t XmlGetAttributeInt64(int64_t element, const char* name, int32_t* err)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| element | int64_t | 元素句柄 |
| name | string | 属性名称 |
| err | int32_t* | 错误码输出参数,可为NULL |
示例
int32_t err = 0;
int64_t doc = XmlParse("<data size=\"9223372036854775807\"/>", &err);
int64_t root = XmlGetRootElement(doc, &err);
int64_t size = XmlGetAttributeInt64(root, "size", &err);
printf("大小:%lld\n", size);
XmlFree(doc);
返回值
| 返回值类型 | 说明 |
|---|---|
| int64_t | 返回64位整数值,失败时返回0 |
注意事项
- 如果属性不存在或无法转换为64位整数,返回0
- 适用于需要存储大整数的场景
