-#if defined(__WINDOWS__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__UNIX__)
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__WXMAC__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__OS2__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
+ switch ( m_mode )
+ {
+ case wxEOL_DOS:
+ out << _T("\r\n");
+ continue;
+
+ case wxEOL_MAC:
+ out << _T('\r');
+ continue;
+
+ default:
+ wxFAIL_MSG( _T("unknown EOL mode in wxTextOutputStream") );
+ // fall through
+
+ case wxEOL_UNIX:
+ // don't treat '\n' specially
+ ;
+ }
+ }
+
+ out << c;
+ }
+
+ // We must not write the trailing NULL here
+#if wxUSE_UNICODE
+ wxCharBuffer buffer = m_conv.cWC2MB( out );
+ m_output.Write( (const char*) buffer, strlen( (const char*) buffer ) );