---
title: 属性信息读取
description: "- 任意类型属性信息读取。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0072.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0072.html
indexId: a3a86a02876da8db9d8a92200f1010aa3563da6f50060cb7a241d8c6a457a8c858
---
# 属性信息读取

#### 函数定义

- 任意类型属性信息读取。
  int ncmpi_get_att(int fileId, int varid, const char* name, void* value);

- char类型属性信息读取。
  int ncmpi_get_att_text(int fileId, int varid, const char* name, char* ip);

- int类型属性信息读取。
  int ncmpi_get_att_int(int fileId, int varid, const char* name, int* ip);

- float类型属性信息读取。
  int ncmpi_get_att_float(int fileId, int varid, const char* name, float* ip);

- double类型属性信息读取。
  int ncmpi_get_att_double(int fileId, int varid, const char* name, double* ip);


#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| fileId | 文件ID | 非负整数 | 输入 |
| varid | variable ID | 非负整数 | 输入 |
| \*name | att名称 | 非空，长度小于256字节 | 输入 |
| \*ip | 读取属性信息的内存的指针 | 非空 | 输出 |


#### 返回值

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


#### 错误码

| 错误码 | 描述 |
| --- | --- |
| NC\_EBADID | 无效ncid |
| NC\_EBADNAME | 无效名称 |
| NC\_ENOMEM | 空指针或无效内存 |
| NC\_EINVAL | 无效的参数 |
