Return the old file descriptor/pointer from wx(F)File::Detach().

Make Detach() more convenient to use.

Closes #15494.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-09-12 20:49:10 +00:00
parent 2cedd586b5
commit 37961915e7
5 changed files with 11 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ public:
// assign an existing file descriptor and get it back from wxFile object
void Attach(int lfd) { Close(); m_fd = lfd; m_lasterror = 0; }
void Detach() { m_fd = fd_invalid; }
int Detach() { int fdOld = m_fd; m_fd = fd_invalid; return fdOld; }
int fd() const { return m_fd; }
// read/write (unbuffered)