+bool wxStyledTextCtrl::SaveFile(const wxString& filename)
+{
+ wxFile file(filename, wxFile::write);
+
+ if (!file.IsOpened())
+ return FALSE;
+
+ bool success = file.Write(GetText());
+
+ if (success)
+ SetSavePoint();
+
+ return success;
+}
+
+bool wxStyledTextCtrl::LoadFile(const wxString& filename)
+{
+ wxFile file(filename, wxFile::read);
+
+ if (!file.IsOpened())
+ return FALSE;
+
+ wxString contents;
+ off_t len = file.Length();
+
+ wxChar *buf = contents.GetWriteBuf(len);
+ bool success = (file.Read(buf, len) == len);
+ contents.UngetWriteBuf();
+
+ if (success)
+ {
+ SetText(contents);
+ EmptyUndoBuffer();
+ SetSavePoint();
+ }
+
+ return success;
+}
+