+BTree* BTree::Open (const std::string &name)
+{
+ /* Leo los bloques recuperables */
+ FILE *fp;
+ BTree *tree = new BTree ();
+
+ std::string del = name + ".del";
+
+ fp = fopen (del.c_str (), "wb");
+ if (fp != NULL) {
+ uint i;
+
+ while (fread (&i, 1, sizeof (uint), fp)) {
+ tree->deleted_nodes.push_back (i);
+ }
+
+ fclose (fp);
+ }
+
+ del = name + ".blockdel";
+
+ fp = fopen (del.c_str (), "wb");
+ if (fp != NULL) {
+ uint i;
+
+ while (fread (&i, 1, sizeof (uint), fp)) {
+ tree->deleted_block_data.push_back (i);
+ }
+
+ fclose (fp);
+ }
+
+ tree->filename = name;
+ tree->fp = fopen (name.c_str(), "rb+");
+ if (!fp) {
+ /* TODO : mandar una exception ? */
+ delete tree;
+ return NULL;
+ }
+ tree->ReadFileHeader ();
+
+ if (strcmp ("DILUMA", tree->header.magic)) {
+ /* Arbol no tiene magic!! */
+ delete tree;
+ return NULL;
+ }
+
+ return tree;
+}
+