chmod

PHOTO EMBED

Wed May 08 2024 16:46:18 GMT+0000 (Coordinated Universal Time)

Saved by @signup

#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