当前位置:Gxlcms > 数据库问题 > Linux access

Linux access

时间:2021-07-01 10:21:17 帮助过:3人阅读

  • #include <stdlib.h> 
  • #include <unistd.h> 
  • #include <fcntl.h> 
  •  
  • int main() 
  •     if((access("test.c",F_OK))!=-1) 
  •     { 
  •         printf("文件 test.c 存在. "); 
  •     } 
  •     else 
  •     { 
  •         printf("test.c 不存在! "); 
  •     } 
  •  
  •     if(access("test.c",R_OK)!=-1) 
  •     { 
  •         printf("test.c 有可读权限"); 
  •     } 
  •     else 
  •     { 
  •         printf("test.c 不可读. "); 
  •     } 
  •  
  •     if(access("test.c",W_OK)!=-1) 
  •     { 
  •         printf("test.c 有可写权限"); 
  •     } 
  •     else 
  •     { 
  •         printf("test.c 不可写. "); 
  •     } 
  •     if(access("test.c",X_OK)!=-1) 
  •     { 
  •         printf("test.c 有可执行权限"); 
  •     } 
  •     else 
  •     { 
  •         printf("test.c 不可执行. "); 
  •     } 
  •  
  •     return 0; 
  • Linux access

    标签:

    人气教程排行