27 #define TMP_EXT ".tmp" 34 fname_tmp =
static_cast<char *
>(malloc(strlen(fname)+
sizeof(
TMP_EXT)));
35 if (fname_tmp == NULL) {
40 sprintf(fname_tmp,
"%s%s", fname,
TMP_EXT);
42 f = fopen(fname_tmp,
"w");
44 LOG(
llevError,
"could not open %s: %s\n", fname_tmp, strerror(errno));
50 if (of->
fname == NULL) {
62 if (ferror(of->
file)) {
70 if (fclose(of->
file) != 0) {
void of_cancel(OutputFile *of)
Cancels a save process.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
FILE * file
The file pointer for fname_tmp.
Global type definitions and header inclusions.
char * fname_tmp
The temporary output file that is written to until of_close() is called.
#define TMP_EXT
The extension for temporary files that is appended to the original output filename during write opera...
FILE * of_open(OutputFile *of, const char *fname)
Opens an output file.
int of_close(OutputFile *of)
Closes an output file.
Functions for creating text output files.
char * fname
The original output file that is written.