A wrapper for the cstdio file type that closes the file automatically when the scope is left.
More...
#include <mia/core/file.hh>
A wrapper for the cstdio file type that closes the file automatically when the scope is left.
This class implements a transparent wrapper around the C stdio FILE type to make it possible that the file is closed autmatically when the scope of the file variable is left. A variable of this type can be used with all the C-stdio functions that take a file pointer as argument.
Definition at line 46 of file file.hh.
◆ CFile()
CFile::CFile |
( |
const std::string & |
filename, |
|
|
bool |
from_stdio, |
|
|
bool |
write |
|
) |
| |
constructor
- Parameters
-
filename | of the file to handle |
from_stdio | use stdin or stdout |
write | open for writing or reading |
◆ ~CFile()
virtual CFile::~CFile |
( |
| ) |
|
throw | ( | |
| ) | | |
|
virtual |
destructor, closes file if necessary
◆ operator PFILE()
CFile::operator PFILE |
( |
| ) |
|
- Returns
- the stdio FILE pointer
◆ operator!()
bool CFile::operator! |
( |
| ) |
const |
- Returns
- true if the file is not open (i.e. the FILE pointer is NULL
The documentation for this class was generated from the following file: