2003-06-18 09:56:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file copy.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2003-07-28 22:37:28 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-06-18 09:56:10 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-06-18 09:56:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
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"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
2000-09-05 13:16:19 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
using std::ifstream;
|
|
|
|
|
using std::ofstream;
|
|
|
|
|
using std::ios;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
|
bool lyx::support::copy(string const & from, string const & to)
|
2000-09-05 13:16:19 +00:00
|
|
|
|
{
|
2005-02-17 17:53:33 +00:00
|
|
|
|
ifstream ifs(from.c_str(), ios::binary | ios::in);
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (!ifs)
|
|
|
|
|
return false;
|
2005-02-17 17:53:33 +00:00
|
|
|
|
|
|
|
|
|
ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc);
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (!ofs)
|
|
|
|
|
return false;
|
2005-02-17 17:53:33 +00:00
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
ofs << ifs.rdbuf();
|
2005-02-17 17:53:33 +00:00
|
|
|
|
return ofs.good();
|
2000-09-05 13:16:19 +00:00
|
|
|
|
}
|