Wrap file descriptors in a class to ensure closed.
More...
#include <sos/fdstream.h>
|
| FD (const std::string &name, int mode, bool lock) |
| constructor which opens the file More...
|
|
| FD (int x) |
| constructor for existing file descriptor More...
|
|
| ~FD () |
| destructor
|
|
| operator int () |
| type conversion
|
|
|
static void | report (std::ostream &s, int fd) |
| Report the details or status of a file descriptor. More...
|
|
Wrap file descriptors in a class to ensure closed.
The FD class is used to wrap a file descriptor so that it will be automatically closed when it goes out of scope. This ensures that file descriptors are closed when an exception is thrown.
FD::FD |
( |
const std::string & |
name, |
|
|
int |
mode, |
|
|
bool |
lock |
|
) |
| |
constructor which opens the file
- Parameters
-
name | the name of file to open |
mode | the open mode |
lock | if true the file is also locked |
VICI::cfi::FD::FD |
( |
int |
x | ) |
|
|
inline |
constructor for existing file descriptor
- Parameters
-
x | the existing file descriptor |
void FD::report |
( |
std::ostream & |
s, |
|
|
int |
fd |
|
) |
| |
|
static |
Report the details or status of a file descriptor.
- Parameters
-
s | the stream to write to |
fd | the file descriptor to examine. |
The documentation for this class was generated from the following files: