-#if wxUSE_UNICODE
- wxMemoryBuffer buffer(len+1);
- success = (file.Read(buffer.GetData(), len) == len);
- if (success) {
- ((char*)buffer.GetData())[len] = 0;
- contents = wxString(buffer, *wxConvCurrent, len);
- }
-#else
- wxString buffer;
- success = (file.Read(wxStringBuffer(buffer, len), len) == len);
- contents = buffer;
-#endif
- }
- else
- {
- if (len == 0)
- success = true; // empty file is ok
- else
- success = false; // len == wxInvalidOffset
- }
-
- if (success)
- {
- SetText(contents);
- EmptyUndoBuffer();
- SetSavePoint();