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();
|
~CServiceManager();
|
||||||
static CServiceManager * getInstance();
|
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 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);
|
bool LoadServices(bool only_current);
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
//#define SAVE_DEBUG
|
//#define SAVE_DEBUG
|
||||||
|
|
||||||
@@ -968,13 +969,18 @@ do_current:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServiceManager::CopyFile(char * from, char * to)
|
void CServiceManager::CopyFile(const char * from, const char * to)
|
||||||
{
|
{
|
||||||
char cmd[256] = "cp -f ";
|
std::ifstream in(from, std::ios::in | std::ios::binary);
|
||||||
strcat(cmd, from);
|
if(in.good()){
|
||||||
strcat(cmd, " ");
|
std::ofstream out(to, std::ios::out | std::ios::binary);
|
||||||
strcat(cmd, to);
|
if(out.good()){
|
||||||
system(cmd);
|
out << in.rdbuf();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
remove(from);
|
||||||
|
}
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user