Versions Compared

Key

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

...

The following noncompliant code example shows a case where a file is removed while it is still open.:

Code Block
bgColor#FFcccc
langc
char *file_name;
FILE *file;

/* Initialize file_name */

file = fopen(file_name, "w+");
if (file == NULL) {
  /* Handle error condition */
}

/* ... */

if (remove(file_name) != 0) {
  /* Handle error condition */
}

/* Continue performing I/O operations on file */

fclose(file);

...

 

...