...
Code Block | ||
---|---|---|
| ||
/* program code */ const char *old = "oldfile.ext"; const char *new = "newfile.ext"; FILE *file = fopen(new, "r"); if (!file) { if (rename(old, new) != 0) { /* Handle removerename failure */ } } else { fclose(file); /* handle error condition */ } /* program code */ |
...