请输入您要查询的百科知识:

 

词条 waccess
释义

函数原型

int _waccess( const wchar_t *path, int mode );

功能

判断是否允许访问。

返回值

返回0,则文件为指定的模式。返回-1,则文件不存在或者不能用指定的模式访问。如果在指定的是目录,则仅仅是目录不存在。

参数

int _waccess( const wchar_t *path, int mode );

path : 文件路径或目录名。为Unicode字符。

mode:模式

模式 检查文件方式

00 存在

02  允许写

04 允许读

06 允许读和写

示例

/* ACCESS.C: This example uses _access to check the

* file named "ACCESS.C" to see if it exists and if

* writing is allowed.

*/

#include <io.h>

#include <stdio.h>

#include <stdlib.h>

void main( void )

{

/* Check for existence */

if( (_access( "ACCESS.C", 0 )) != -1 )

{

printf( "File ACCESS.C exists\" );

/* Check for write permission */

if( (_access( "ACCESS.C", 2 )) != -1 )

printf( "File ACCESS.C has write permission\" );

}

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/1 20:01:17