X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/46f8786311d03a7d9869d814a3d6f020a3498ed4..358553d9f9e9f4414e54d210807fb27832117884:/src/btree.cpp?ds=inline diff --git a/src/btree.cpp b/src/btree.cpp index 6771746..0ad4961 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -33,11 +33,27 @@ BTree::BTree (const std::string &name, unsigned int block_size, int tt, int kt, delete [] node; } +BTree::BTree (const std::string &name) +{ + fp = fopen (name.c_str(), "rb+"); + if (!fp) { + /* TODO : mandar una exception ? */ + return; + } + ReadFileHeader (); +} + BTree::~BTree () { fclose (fp); } +void BTree::ReadFileHeader () +{ + fseek (fp, 0L, SEEK_SET); + fread (&header, 1, sizeof (BTreeFileHeader), fp); +} + void BTree::WriteFileHeader () { fseek (fp, 0L, SEEK_SET);