#if wxUSE_FILE
#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
#endif
#include "wx/ffile.h"
{
wxASSERT_MSG( !m_fp, _T("should close or detach the old file first") );
+#if wxUSE_UNICODE
+ char *tmp_fname;
+ size_t fname_len;
+
+ fname_len = wxStrlen(filename)+1;
+ tmp_fname = new char[fname_len];
+ wxWX2MB(tmp_fname, filename, fname_len);
+
+ m_fp = fopen(tmp_fname, mode);
+
+ delete tmp_fname;
+#else
m_fp = fopen(filename, mode);
+#endif
+
if ( !m_fp )
{
{
if ( IsOpened() )
{
- if ( !fclose(m_fp) )
+ if ( fclose(m_fp) != 0 )
{
wxLogSysError(_("can't close file '%s'"), m_name.c_str());
{
if ( IsOpened() )
{
- if ( !fflush(m_fp) )
+ // fflush returns non-zero on error
+ //
+ if ( fflush(m_fp) )
{
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());