#include <File.hpp>
Public Member Functions | |
File (const char *path, const char *mode) throw (IOException) | |
Open the specified file. More... | |
void | close () throw (IOException) |
Close the file. More... | |
~File () | |
Destructor. More... | |
FILE * | get () |
Get pointer to opened file. More... | |
Class used for opening files. File class using RAII (Resource Acquisition Is Initialization) technique. This ensures that the file is properly closed even when an exception occurs.
|
inline |
Open the specified file.
path | path to a file |
mode | mode as defined by the fopen() function |
IOException | if the file cannot be opened. |
|
inline |
Destructor.
This desctructor closes the file in case it was not closed using the close() function beforehand.
However, in comparison to the close() function, the destructor doesn't report possible errors using the expcetion mechanism. That is because it is dangerous to throw exceptions in destructor and the behaviour is undefined.
|
inline |
Close the file.
IOException | if the file can't be closed. |
|
inline |
Get pointer to opened file.