Adjust Header to be non Nul Terminated
This commit is contained in:
@@ -99,9 +99,8 @@ namespace file
|
||||
{
|
||||
std::ifstream in(BASE_DIRECTORY LOGBOOK, std::ifstream::binary);
|
||||
|
||||
// File Header
|
||||
std::string ident = readString(in, 5);
|
||||
if (ident.compare("VGAL") != 0) {
|
||||
if (ident.compare(LOGBOOK_HEADER) != 0) {
|
||||
throw std::invalid_argument("Wrong file");
|
||||
}
|
||||
std::uint8_t version = read<std::uint8_t>(in);
|
||||
@@ -129,8 +128,8 @@ namespace file
|
||||
inline void toFile() const
|
||||
{
|
||||
std::ofstream out(BASE_DIRECTORY LOGBOOK, std::fstream::binary);
|
||||
char header[] = {'V', 'G', 'A', 'L', '\0', 1};
|
||||
out.write(header, 6);
|
||||
out.write(LOGBOOK_HEADER, 4);
|
||||
out.write("\1", 1);
|
||||
for (const LogbookEntry &entry : this->entries) {
|
||||
entry.toFile(out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user