Пример #1
0
void DecompressFile(){
	cout << " What is the name of the file you want to decompress? " << endl;
	string compressedFileName = GetLine();
	ibstream filetoDecompress;
	filetoDecompress.open(compressedFileName.c_str());
	if (filetoDecompress.fail()) Error(" Failed to open the specified file");
	cout << " What should we name the decompressed file? " << endl;
	string newDecompedFile = GetLine();

	Encoding dfile;
	obstream decompedFile;
	decompedFile.open(newDecompedFile.c_str());
	dfile.decompress(filetoDecompress, decompedFile);
}
Пример #2
0
int main() {
    string command;
    ibstream infile;
    obstream outfile;
    Encoding huffman;
    while(true){
        infile.clear();
        outfile.clear();
        getLine("compress(c) or decompress(d)", command);
        if(command == "c"){
            huffman.compress(infile, outfile);
        }else if(command == "d"){
            huffman.decompress(infile, outfile);
        }else if(command == "exit")
            break;
        else{
            cout << "invalid command" << endl;
        }
    }
    return 0;
}