...
Code Block | ||
---|---|---|
| ||
... FILE * f_ptr; f_ptr = fopen(file_name,"w"); if (!f_ptr) { /* Handle fopen() Error */ } ... if (chmod(file_name, new_mode) == -1) { /* Handle chmod() Error */ } /* Process file */ /* ... */ |
...
Code Block | ||
---|---|---|
| ||
/* ... */ fd = open(file_name, O_WRONLY | O_CREAT | O_EXCL, file_mode); if (fd == -1) { /* Handle open() error */ } /* ... */ if (fchmod(fd, new_mode) == -1) { /* Handle fchmod() Error */ } /* Process file */ /* ... */ |
...