chmod.c
Fri May 10 2024 02:29:16 GMT+0000 (Coordinated Universal Time)
Saved by
@exam123
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>
#include <stdio.h>
int main(int argc,char *argv[])
{
const char *p=argv[1];
const char *f= argv[2];
mode_t mode=strtol(p,NULL,8);
if(chmod(f,mode)==-1)
{
perror("chmod");
exit (EXIT_FAILURE);
}
printf("perms are changed");
return 0;
}
content_copyCOPY
Comments