chmod

PHOTO EMBED

Tue May 07 2024 13:21:59 GMT+0000 (Coordinated Universal Time)

Saved by @login123

#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h> 

int main() {
    const char *filename = "example.txt";
    mode_t mode = 0644; 
    
    if (chmod(filename, mode) == -1) {
        perror("chmod");
        exit(EXIT_FAILURE);
    }
    
    printf("File permission successfully changed\n");
    return 0;
}
content_copyCOPY