词条 | 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条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。