24 if (access(name.c_str(), F_OK)==0)
26 Error(
"File '"+name+
"' already exists.");
33 fOut.open(name.c_str(), ios_base::out);
37 str <<
"ofstream::open() failed for '" << name <<
"': " << strerror(errno) <<
" [errno=" << errno <<
"]";
45 static uint32_t
FACT = 0xFAC77e1e;
47 fOut.write(reinterpret_cast<char*>(&FACT), 4);
54 fOut.write(reinterpret_cast<const char*>(&h),
sizeof(
RUN_HEAD)-
sizeof(PEVNT_HEADER*));
56 for (
int i=0;
i<40;
i++)
59 fOut.write(reinterpret_cast<const char*>(h.
FADhead+
i),
sizeof(PEVNT_HEADER));
63 const vector<char> block(
sizeof(uint32_t));
67 fOut.write(block.data(), block.size());
72 str <<
"ofstream::write() failed for '" << name <<
"': " << strerror(errno) <<
" [errno=" << errno <<
"]";
Namespace to help with some general things in the program initialization.
uint32_t GetRunId() const
void WriteBlockHeader(uint32_t type, uint32_t ver, uint32_t cnt, uint32_t len)
int Error(const std::string &str)
void WriteValue(const T &t)
PEVNT_HEADER FADhead[NBOARDS]
static std::string FormFileName(const std::string &path, uint64_t night, uint32_t runid, const std::string &extension)