X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..cd71293400b25ff967cd032b8e1998b403003890:/include/wx/file.h diff --git a/include/wx/file.h b/include/wx/file.h index ece4086f95..bf58ce69c0 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -21,7 +21,8 @@ // simple types // ---------------------------------------------------------------------------- -#include +#include "wx/string.h" +#include "wx/filefn.h" // define off_t #include @@ -50,7 +51,7 @@ public: // ------------------- // opening mode - enum OpenMode { read, write, read_write }; + enum OpenMode { read, write, read_write, write_append }; // standard values for file descriptor enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr }; // seek type @@ -72,8 +73,12 @@ public: // open/close bool Create(const char *szFileName, bool bOverwrite = FALSE); bool Open(const char *szFileName, OpenMode mode = read); + inline bool Close(); // Close is a NOP if not opened + + // assign an existing file descriptor and get it back from wxFile object void Attach(int fd) { Close(); m_fd = fd; } - inline void Close(); // Close is a NOP if not opened + void Detach() { m_fd = fd_invalid; } + int fd() const { return m_fd; } // read/write (unbuffered) // returns number of bytes read or ofsInvalid on error