2000-09-05 13:16:19 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
2000-09-05 13:16:19 +00:00
|
|
|
#include "support/lyxlib.h"
|
|
|
|
#include "LString.h"
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
using std::ifstream;
|
|
|
|
using std::ofstream;
|
|
|
|
using std::ios;
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
bool lyx::copy(string const & from, string const & to)
|
2000-09-05 13:16:19 +00:00
|
|
|
{
|
2002-02-16 15:59:55 +00:00
|
|
|
ifstream ifs(from.c_str());
|
|
|
|
if (!ifs)
|
|
|
|
return false;
|
|
|
|
ofstream ofs(to.c_str(),
|
|
|
|
ios::binary | ios::out | ios::trunc);
|
|
|
|
if (!ofs)
|
|
|
|
return false;
|
2000-09-14 17:53:12 +00:00
|
|
|
ofs << ifs.rdbuf();
|
2002-02-16 15:59:55 +00:00
|
|
|
if (ofs.good())
|
|
|
|
return true;
|
2000-09-14 17:53:12 +00:00
|
|
|
return false;
|
2000-09-05 13:16:19 +00:00
|
|
|
}
|