---
title: 设置变量访问方式
description: "nc_var_par_access(int ncid, int varid, int par_access)"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0051.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/userg_hyperio_0051.html
indexId: 391f5618aeef3f006c4caf58494661f14e7b4a546409cfb3dd62467601c9961f58
---
# 设置变量访问方式

#### 函数定义

nc_var_par_access(int ncid, int varid, int par_access)


#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| ncid | 文件ID | 非负整数 | 输入 |
| varid | 变量ID | 非空 | 输入 |
| par\_access | 访问方式 | NC\_COLLECTIVE或NC\_INDEPENDENT | 输入 |


#### 返回值

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


#### 错误码

| 错误码 | 描述 |
| --- | --- |
| NC\_EBADID | 无效ncid |
| NC\_ENOTVAR | 无效变量ID |
| NC\_EINVAL | 无效参数 |
