X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1f82b073f53542b6baf63f6485962da63ab85d9..794bcc2dea743ac907b839f54e451847c9ea4b72:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 8f693926e5..1f8003aff7 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2191,6 +2191,42 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename) fclose (fd1); return TRUE; } +#else +bool wxTransferFileToStream(const wxString& filename, wxOutputStream& stream) +{ + FILE *fd1; + int ch; + + if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL) + return FALSE; + + while ((ch = getc (fd1)) != EOF) + stream.PutC((char) ch); + + fclose (fd1); + return TRUE; +} + +bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename) +{ + FILE *fd1; + char ch; + + if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL) + { + return FALSE; + } + + int len = stream.StreamSize(); + // TODO: is this the correct test for EOF? + while (stream.TellI() < (len - 1)) + { + ch = stream.GetC(); + putc (ch, fd1); + } + fclose (fd1); + return TRUE; +} #endif #endif // wxUSE_DOC_VIEW_ARCHITECTURE