Versions Compared

Key

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

...

After a program obtains a file name using the tmpnam_s}} function and before the program creates a file with that name, the possibility exists that someone else may create a file with that same name. To avoid this race condition, the {{tmpfile_s function should be used instead of tmpnam_s when possible. One situation that requires the use of the tmpnam_s function is when the program needs to create a temporary directory rather than a temporary file.

Code Block
bgColor#ccccff

/* ... */
if (tmpfile_s(&file_ptrfp)) {
  /* Handle Error */
}
/* ... */

Wiki Markup
The {{tmpfile_s()}} function may not be compliant with \[[TMP33-C. Temporary files must be removed before the program exits]\] for implementations where the temporary file is not removed if the program terminates abnormally.

...