Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Trivia, except that the specified permissions when a POSIX-compliant open() creates a file is - unconditionally - modified by umask()

...

Wiki Markup
The {{fopen_s()}} function defined in ISO/IEC TR 24731-1 \[[ISO/IEC TR 24731-1-2007|AA. C References#ISO/IEC TR 24731-1-2007]\] can be used to create a file with restricedrestricted permissions.  Specifically, ISO/IEC TR 24731-1 states:

...

Access permissions for the newly created file should be specified in the third parameter to open(). Again, the permissions may will be influenced modified by the value of umask().

Code Block
bgColor#ccccff
/* ... */
int fd = open(file_name, O_CREAT | O_WRONLY, file_access_permissions);
if (fd == -1){
  /* Handle Error */
}
/* ... */

...