Question: void Decompress(const char* _outputFile) { // TODO: // 1. Create a BitIfStream and read the frequency table BitIfstream bitIfStream(mFileName.c_str(), (char*)mFrequencyTable, 256); // 2. Create the

void Decompress(const char* _outputFile) { // TODO: // 1. Create a BitIfStream and read the frequency table BitIfstream bitIfStream(mFileName.c_str(), (char*)mFrequencyTable, 256); // 2. Create the leaf list and tree (in this order) GenerateLeafList(); GenerateTree(); // 3. Create a standard ofstream for output (binary mode) std::ofstream outputFile(_outputFile, std::ios_base::binary); // 4. Create a bool to use for traversing down the list, and a char to store the character for writing bool bitValue; char outputChar; // 5. Create a node pointer for use in traversing the list (start it at the top) HuffNode* point = mRoot; // 6. Go through the compressed file one bit at a time, traversing through the tree // When you get to a leaf node, write out the value, and go back to the root // Note: Remember, there may be trailing 0's at the end of the file, so only loop the appropriate number of times while (bitIfStream.Read(bitValue)) { if (bitValue) { point = point->right; } else { point = point->left; } if (point->IsLeaf) { outputChar = point->value; outputFile.put(outputChar); point = mRoot; } } // 7. Close the streams bitIfStream.Close(); outputFile.close(); // 8. Clean up the dynamic memory by clearing the tree ClearTree(); }

For question 6 I get two errors. The .Read and the IsLeaf are the ones shooting the errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!