]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/file.cpp
Use our own getters and properties for wxVisualAttributes
[wxWidgets.git] / src / common / file.cpp
index 7c494b4d714e4a098df9092890ef3d81adecbe72..593d78b5881f183b192d3f8056956584dfcdbf05 100644 (file)
     };
 #endif // W_OK
 
-// there is no distinction between text and binary files under Unix, so define
-// O_BINARY as 0 if the system headers don't do it already
-#if defined(__UNIX__) && !defined(O_BINARY)
-    #define   O_BINARY    (0)
-#endif  //__UNIX__
-
 #ifdef __SALFORDC__
     #include <unix.h>
 #endif
 
-#ifndef MAX_PATH
-    #define MAX_PATH 512
-#endif
-
 // some broken compilers don't have 3rd argument in open() and creat()
 #ifdef __SALFORDC__
     #define ACCESS(access)
 #include  "wx/file.h"
 #include  "wx/filefn.h"
 
+// there is no distinction between text and binary files under Unix, so define
+// O_BINARY as 0 if the system headers don't do it already
+#if defined(__UNIX__) && !defined(O_BINARY)
+    #define   O_BINARY    (0)
+#endif  //__UNIX__
+
 #ifdef __WXMSW__
     #include "wx/msw/mslu.h"
 #endif
     #include "wx/msw/private.h"
 #endif
 
+#ifndef MAX_PATH
+    #define MAX_PATH 512
+#endif
 
 // ============================================================================
 // implementation of wxFile
@@ -324,6 +323,16 @@ size_t wxFile::Write(const void *pBuf, size_t nCount)
     return iRc;
 }
 
+bool wxFile::Write(const wxString& s, const wxMBConv& conv)
+{
+  const wxWX2MBbuf buf = s.mb_str(conv);
+  if ( !buf )
+      return false;
+
+  const size_t size = strlen(buf); // FIXME: use buf.length() when available
+  return Write(buf, size) == size;
+}
+
 // flush
 bool wxFile::Flush()
 {