diff --git a/File/File.cpp b/File/File.cpp index d1d3e49..11e8604 100644 --- a/File/File.cpp +++ b/File/File.cpp @@ -26,6 +26,16 @@ File::File(File& f) f._fd = -1; } +File::File(const char *name, int flags, const std::nothrow_t&) +{ + _fd = ::open(name, flags); +} + +File::File(const char *name, bool readOnly, const std::nothrow_t&) +{ + _fd = ::open(name, readOnly ? O_RDONLY : O_RDWR); +} + File::File(const char *name, int flags) { #undef __METHOD__ diff --git a/File/File.h b/File/File.h index 5ada61d..2d83591 100644 --- a/File/File.h +++ b/File/File.h @@ -1,6 +1,8 @@ #ifndef __FILE_H__ #define __FILE_H__ +#include + #include #include #include @@ -12,8 +14,13 @@ class File { File(); File(File &); File(int fd); + File(const char *name, int flags); File(const char *name, bool readOnly); + + File(const char *name, int flags, const std::nothrow_t &); + File(const char *name, bool readOnly, const std::nothrow_t &); + ~File(); bool isValid() const