EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | List of all members
AutoFilePtr Class Reference

Auto-close FILE pointer wrapper. More...

#include <AutoFilePtr.h>

Public Member Functions

 AutoFilePtr (const char *filename, const char *mode)
 Construct AutoFilePtr for given filename and mode. More...
 
 AutoFilePtr (FILE *f=0)
 Construct AutoFilePtr for existing FILE, which is now controlled by the AutoFilePtr. More...
 
 ~AutoFilePtr ()
 Destructor closes the FILE under control of this AutoFilePtr.
 
bool open (const char *filename, const char *mode)
 Open a (new) file.
 
void close ()
 Close the current file.
 
void set (FILE *new_f)
 Release control of the current file, closing it, and switch to a new file. More...
 
 operator bool () const
 Is there an open file?
 
 operator FILE * () const
 Obtain the current FILE.
 

Detailed Description

Auto-close FILE pointer wrapper.

Constructor & Destructor Documentation

AutoFilePtr::AutoFilePtr ( const char *  filename,
const char *  mode 
)
inline

Construct AutoFilePtr for given filename and mode.

To test the result, use the bool operator.

AutoFilePtr::AutoFilePtr ( FILE *  f = 0)
inline

Construct AutoFilePtr for existing FILE, which is now controlled by the AutoFilePtr.

Member Function Documentation

void AutoFilePtr::set ( FILE *  new_f)
inline

Release control of the current file, closing it, and switch to a new file.


The documentation for this class was generated from the following file: