---
title: 属性信息读取
description: "- 读取属性。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0058.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0058.html
indexId: a20f466dee6b013ad785d79931c02386b0d04149502d5bb29a39f8e0a6869dae58
---
# 属性信息读取

#### 函数定义

- 读取属性。
  nc_get_att(int ncid, int varid, const char* name, void *ip)

- 读取int类型属性。
  nc_get_att_int(int ncid, int varid, const char* name, int *ip)

- 读取float类型属性。
  nc_get_att_float(int ncid, int varid, const char* name, float *ip)

- 读取double类型属性。
  nc_get_att_double(int ncid, int varid, const char* name, double *ip)

- 读取文本类型属性。
  nc_get_att_text(int ncid, int varid, const char* name, char *ip)


#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| ncid | 文件ID | 非负整数 | 输入 |
| varid | variable ID | 非负整数 | 输入 |
| name | attribute名称 | 非空 | 输入 |
| ip | 数据指针 | 非空 | 输出 |


#### 返回值

- 成功：返回NC_NOERR。
- 失败：返回错误码。


#### 错误码

| 错误码 | 描述 |
| --- | --- |
| NC\_EBADID | 无效ncid |
| NC\_ENOTVAR | 无效variableid |
| NC\_ENOTATT | 无法找到attribute |
| NC\_EINVAL | 无效参数 |
| NC\_ENOMEM | 内存不足 |


#### 注意

- 用户需要保证指针内存大小正确性，中间件无法检查指针大小。
- 目前仅支持上述类型att的读取。
