]> git.lyx.org Git - lyx.git/blob - src/support/copy.C
The std::string mammoth path.
[lyx.git] / src / support / copy.C
1 /**
2  * \file copy.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include <fstream>
14
15 #include "support/lyxlib.h"
16
17
18 using std::ifstream;
19 using std::ofstream;
20 using std::ios;
21 using std::string;
22
23
24 bool lyx::support::copy(string const & from, string const & to)
25 {
26         ifstream ifs(from.c_str());
27         if (!ifs)
28                 return false;
29         ofstream ofs(to.c_str(),
30                      ios::binary | ios::out | ios::trunc);
31         if (!ofs)
32                 return false;
33         ofs << ifs.rdbuf();
34         if (ofs.good())
35                 return true;
36         return false;
37 }