#include #include #include #include #include int main() { int fd = open("data7.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd == -1) { perror("Error creating file"); return 1; } printf("Attempted to create data7.txt with mode 0666\n"); close(fd); //Verify the actual permissions applied to the file struct stat s; if (stat("data7.txt", &s) == 0) { // Mask out the file type to get just the permission bits mode_t actual_permissions = s.st_mode & 0777; printf("Actual file permissions applied: 0%o\n", actual_permissions); } return 0; }