Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
 ... 
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
bgColor#ccccff
/* ... */
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 */
/* ... */

...