SDDSlib
|
Provides the fopen_e function for opening files with error checking and handling. More...
#include "mdb.h"
Go to the source code of this file.
Functions | |
FILE * | fopen_e (char *file, char *open_mode, long mode) |
Opens a file with error checking, messages, and aborts. | |
Provides the fopen_e function for opening files with error checking and handling.
Definition in file fopen_e.c.
FILE * fopen_e | ( | char * | file, |
char * | open_mode, | ||
long | mode ) |
Opens a file with error checking, messages, and aborts.
This function attempts to open a file with the specified mode. If the file exists and the mode includes FOPEN_SAVE_IF_EXISTS
, it renames the existing file by appending a tilde (~
). If opening the file fails, it either returns NULL
or exits the program based on the mode flags.
file | The path to the file to open. |
open_mode | The mode string for fopen (e.g., "r", "w"). |
mode | Flags controlling behavior (e.g., FOPEN_SAVE_IF_EXISTS , FOPEN_RETURN_ON_ERROR ). |
NULL
if FOPEN_RETURN_ON_ERROR
is set and the file could not be opened. Definition at line 30 of file fopen_e.c.