SDDSlib
|
Provides functions to replace files with options for backup and robust renaming. More...
#include "mdb.h"
Go to the source code of this file.
Functions | |
long | replaceFile (char *file, char *replacement) |
long | renameRobust (char *oldName, char *newName, unsigned long flags) |
long | replaceFileAndBackUp (char *file, char *replacement) |
Replaces a file with a replacement file and creates a backup of the original. | |
Provides functions to replace files with options for backup and robust renaming.
This file contains the implementation of the replaceFile(), replaceFileAndBackUp(), and renameRobust() functions, which handle file replacement with error checking and backup capabilities.
Definition in file replacefile.c.
long renameRobust | ( | char * | oldName, |
char * | newName, | ||
unsigned long | flags ) |
Definition at line 32 of file replacefile.c.
long replaceFile | ( | char * | file, |
char * | replacement ) |
Definition at line 22 of file replacefile.c.
long replaceFileAndBackUp | ( | char * | file, |
char * | replacement ) |
Replaces a file with a replacement file and creates a backup of the original.
Creates a backup of the original file by renaming it with a "~" suffix, then replaces it with the replacement file. If the replacement fails, the function attempts to restore the original file from the backup. Error messages are printed to stderr in case of failures.
file | The name of the file to be replaced. |
replacement | The name of the replacement file. |
Definition at line 75 of file replacefile.c.