...
The following noncompliant code example shows a case where a file is removed while it is still open.:
| Code Block | ||||
|---|---|---|---|---|
| ||||
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);
|
...
...