mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
use fstream in copyfile function
This commit is contained in:
@@ -107,7 +107,7 @@ class CServiceManager
|
||||
~CServiceManager();
|
||||
static CServiceManager * getInstance();
|
||||
|
||||
static void CopyFile(char * from, char * to);
|
||||
static void CopyFile(const char * from, const char * to);
|
||||
|
||||
bool InitSatPosition(t_satellite_position position, const char * name = NULL, bool force = false, delivery_system_t delsys = DVB_S, uint16_t nid = 0);
|
||||
bool LoadServices(bool only_current);
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
|
||||
//#define SAVE_DEBUG
|
||||
|
||||
@@ -968,13 +969,18 @@ do_current:
|
||||
return true;
|
||||
}
|
||||
|
||||
void CServiceManager::CopyFile(char * from, char * to)
|
||||
void CServiceManager::CopyFile(const char * from, const char * to)
|
||||
{
|
||||
char cmd[256] = "cp -f ";
|
||||
strcat(cmd, from);
|
||||
strcat(cmd, " ");
|
||||
strcat(cmd, to);
|
||||
system(cmd);
|
||||
std::ifstream in(from, std::ios::in | std::ios::binary);
|
||||
if(in.good()){
|
||||
std::ofstream out(to, std::ios::out | std::ios::binary);
|
||||
if(out.good()){
|
||||
out << in.rdbuf();
|
||||
out.close();
|
||||
}
|
||||
in.close();
|
||||
remove(from);
|
||||
}
|
||||
sync();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user