X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80fdcdb90ef779185492dab676d461fc34933312..e118367990e341b7ba8e5f02295d7aa8def23d5b:/include/wx/file.h diff --git a/include/wx/file.h b/include/wx/file.h index 044e891fa8..00ac471abf 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -5,7 +5,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 -// RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +18,7 @@ #include "wx/string.h" #include "wx/filefn.h" -#include "wx/strconv.h" +#include "wx/convauto.h" // ---------------------------------------------------------------------------- // class wxFile: raw file IO @@ -66,16 +65,18 @@ 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) + // read all data from the file into a string (useful for text files) + bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); // returns number of bytes read or wxInvalidOffset on error ssize_t Read(void *pBuf, size_t nCount); // returns the number of bytes written size_t Write(const void *pBuf, size_t nCount); // returns true on success - bool Write(const wxString& s, const wxMBConv& conv = wxMBConvUTF8()); + bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()); // flush data not yet written bool Flush();