// 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 = wxConvAuto())
- {
- const wxWX2MBbuf buf = s.mb_str(conv);
- if (buf)
- {
- size_t size = strlen(buf);
- return Write((const char *)buf, size) == size;
- }
- else
- return false;
- }
+ bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
// flush data not yet written
bool Flush();
// 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 = wxConvUTF8)
- {
- const wxWX2MBbuf buf = s.mb_str(conv);
- if (buf)
- {
- size_t size = strlen(buf);
- return Write((const char *) buf, size) == size;
- }
- else
- return false;
- }
+ bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8);
// flush data not yet written
bool Flush();
return nWritten;
}
+bool wxFFile::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;
+}
+
bool wxFFile::Flush()
{
if ( IsOpened() )
{
- // fflush returns non-zero on error
- //
- if ( fflush(m_fp) )
+ if ( fflush(m_fp) != 0 )
{
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
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()
{