当前位置:编程学习 > C/C++ >>

请问一下C语言里的access函数整么用?

追问:那请问它的值有哪几种情况?
答案:是,内容如下,希望采纳

 

please check it in MSDN

_access, _waccess
Determine file-access permission.

int _access( const char *path, int mode );

/* 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\n" );
      /* Check for write permission */
      if( (_access( "ACCESS.C", 2 )) != -1 )
         printf( "File ACCESS.C has write permission\n" );
   }
}


Output

File ACCESS.C exists
File ACCESS.C has write permission

没用过

上一个:帮我设计个C语言课程设计 谢谢
下一个:c语言一些学习的资料从那找?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,