]> git.lyx.org Git - lyx.git/blobdiff - src/support/copy.C
If I ever see another licence blurb again, it'll be too soon...
[lyx.git] / src / support / copy.C
index 4c083da791cc7e7d26d6202f1090320e715db2cf..6d513216edc61d5d96efda913c42aaaaa172d0e1 100644 (file)
@@ -1,18 +1,35 @@
+/**
+ * \file copy.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include <fstream>
 
 #include "support/lyxlib.h"
 #include "LString.h"
-#include "support/filetools.h"
 
-bool lyx::copy(string const & from, string const & to)
+using std::ifstream;
+using std::ofstream;
+using std::ios;
+
+bool lyx::support::copy(string const & from, string const & to)
 {
-       std::ifstream ifs(from.c_str());
-       if (!ifs) return false;
-       std::ofstream ofs(to.c_str(), std::ios::out|std::ios::trunc);
-       if (!ofs) return false;
+       ifstream ifs(from.c_str());
+       if (!ifs)
+               return false;
+       ofstream ofs(to.c_str(),
+                    ios::binary | ios::out | ios::trunc);
+       if (!ofs)
+               return false;
        ofs << ifs.rdbuf();
-       if (ofs.good()) return true;
+       if (ofs.good())
+               return true;
        return false;
 }