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