From fe4cbc1dc5555d6907cc52fa16b7d2e179de9e8c Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 17 Feb 2005 17:53:38 +0000 Subject: [PATCH] Enable lyx::copy to work when compiled with the gcc 2.95 compiler and stdlib. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9646 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/ChangeLog | 6 ++++++ src/support/copy.C | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 23e2d76ee4..109a9be056 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,9 @@ +2005-02-17 Angus Leeming + + * copy.C (copy): Pass the ios::in flag to the ifstream constructor. + Enables copying to work when the code is compiled with the gcc 2.95 + compiler and stdlib. + 2005-02-15 Angus Leeming * filetools.C (setEnvPath): compare iterators rather than use tellp(). diff --git a/src/support/copy.C b/src/support/copy.C index 0d0c32b98b..d4cece70d6 100644 --- a/src/support/copy.C +++ b/src/support/copy.C @@ -11,15 +11,14 @@ using std::ios; bool lyx::copy(string const & from, string const & to) { - ifstream ifs(from.c_str(), ios::binary); + ifstream ifs(from.c_str(), ios::binary | ios::in); if (!ifs) return false; - ofstream ofs(to.c_str(), - ios::binary | ios::out | ios::trunc); + + ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc); if (!ofs) return false; + ofs << ifs.rdbuf(); - if (ofs.good()) - return true; - return false; + return ofs.good(); }