]> git.lyx.org Git - features.git/blob - src/support/copy.C
use the new sstream return non-pods as const, use string instead of char * in a lot...
[features.git] / src / support / copy.C
1 #include <config.h>
2
3 #include <fstream>
4
5 //#include <stdio.h>
6
7 #include "support/lyxlib.h"
8 #include "LString.h"
9 //#include "support/syscall.h"
10 #include "support/filetools.h"
11
12 bool lyx::copy(string const & from, string const & to)
13 {
14 #if 0
15         string command = "cp " + QuoteName(from) + " " + QuoteName(to);
16         return Systemcalls().startscript(Systemcalls::System,
17                                          command) == 0;
18 #else
19         ifstream ifs(from.c_str());
20         if (!ifs) return false;
21         ofstream ofs(to.c_str(), ios::out|ios::trunc);
22         if (!ofs) return false;
23         ofs << ifs.rdbuf();
24         if (ofs.good()) return true;
25         return false;
26 #endif
27 }