linux c中修改文件权限
#include#include#include#include#include#include#includeint main(int argc,char* argv[]){ if(argc != 2) { printf("Usage:%s filename\n",basename(argv[0])); exit(-1);
·
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <libgen.h>
int main(int argc,char* argv[])
{
if(argc != 2)
{
printf("Usage:%s filename\n",basename(argv[0]));
exit(-1);
}
if(chmod(argv[1],0666) != 0)
perror("chmod"),exit(-1);
printf("chmod %s success.\n",argv[1]);
return 0;
}
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <libgen.h>
int main(int argc,char* argv[])
{
if(argc != 2)
{
printf("Usage:%s filename\n",basename(argv[0]));
exit(-1);
}
if(chmod(argv[1],0666) != 0)
perror("chmod"),exit(-1);
printf("chmod %s success.\n",argv[1]);
return 0;
}
更多推荐
已为社区贡献1条内容
所有评论(0)