---
title: 全变量模式数据写入
description: "char类型全变量模式数据写入。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0077.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0077.html
indexId: b9b3bb3abe1a0bc6f71d94261894988aa02eb06a668700367b6b75e34fbf023e58
---
# 全变量模式数据写入

#### 函数定义

char类型全变量模式数据写入。

int ncmpi_put_var_text(int fileId, int varId, const char *buf)


#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| fileId | 文件ID | 非负整数 | 输入 |
| varId | variable ID | 非负整数 | 输入 |
| \*buf | 指向写入数据的指针 | 非空 | 输入 |


#### 返回值

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


#### 错误码

| 错误码 | 描述 |
| --- | --- |
| NC\_EBADID | 无效ncid |
| NC\_ENOTINDEP | 在集合数据模式下尝试独立I/O操作 |
| NC\_EINVALCOORDS | 指定的索引超出了指定变量的秩的范围 |
| NC\_ENOTVAR | 无效的varid |
