+ if (std::fwrite(this->data, sizeof(ulong), n*blockLength/W+1, file) != n*blockLength/W+1)
+ throw std::runtime_error("BlockArray::Save(): file write error (data).");
+ }
+
+ /**
+ * Load from file
+ */
+ BlockArray(FILE *file)
+ {
+ if (std::fread(&(this->n), sizeof(ulong), 1, file) != 1)
+ throw std::runtime_error("BlockArray::Load(): file read error (n).");
+ if (std::fread(&(this->blockLength), sizeof(ulong), 1, file) != 1)
+ throw std::runtime_error("BlockArray::Load(): file read error (blockLength).");
+
+ data = new ulong[n*blockLength/W+1];
+ if (std::fread(this->data, sizeof(ulong), n*blockLength/W+1, file) != n*blockLength/W+1)
+ throw std::runtime_error("BlockArray::Load(): file read error (data).");
+ }