-#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;
+ }
+
+#if wxUSE_UNICODE
+ wxCharBuffer buffer = m_conv->cWC2MB(out, out.length(), &len);
+ m_output.Write(buffer, len);