3 #ifndef __AUTO_FILE_PRT_H__
4 #define __AUTO_FILE_PRT_H__
10 #include "tools/NoCopy.h"
39 bool open(
const char *filename,
const char *mode)
41 set(fopen(filename, mode));
61 operator bool ()
const
67 operator FILE * ()
const
~AutoFilePtr()
Destructor closes the FILE under control of this AutoFilePtr.
Definition: AutoFilePtr.h:33
Auto-close FILE pointer wrapper.
Definition: AutoFilePtr.h:15
void set(FILE *new_f)
Release control of the current file, closing it, and switch to a new file.
Definition: AutoFilePtr.h:53
bool open(const char *filename, const char *mode)
Open a (new) file.
Definition: AutoFilePtr.h:39
void close()
Close the current file.
Definition: AutoFilePtr.h:46
AutoFilePtr(const char *filename, const char *mode)
Construct AutoFilePtr for given filename and mode.
Definition: AutoFilePtr.h:22
AutoFilePtr(FILE *f=0)
Construct AutoFilePtr for existing FILE, which is now controlled by the AutoFilePtr.
Definition: AutoFilePtr.h:30