summaryrefslogtreecommitdiff
path: root/p2pvr/daemonbase/fileSink.cpp
blob: dade92183fb9cbeb4e7e80404f61f10a52bc2061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <pch.hpp>
#include "fileSink.h"

FileSink::FileSink(const boost::filesystem::path & path) :
	file(fopen(path.string().c_str(), "w"))
{
}

FileSink::FileSink(int fd) :
	file(fdopen(fd, "w"))
{
}

FileSink::~FileSink()
{
	if (file) {
		fclose(file);
	}
}

bool
FileSink::NewData(const P2PVR::Data & data, const Ice::Current &)
{
	fwrite(&data.front(), data.size(), 1, file);
	return false;
}