#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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter