- This is a program to compress and decompress a file using huffman coding algorithm.
Note: the program compress only text files
- If you don't know how to compile c program with multiple directories and files you need to have gcc compiler, git and Makefile installed on your system and follow the steps bellow:
- Open your terminal or command line
- Clone this repository by typing this command: git clone https://github.com/Abderrahmanehocine/compress-and-decompress-files-using-huffman-coding.git
- Go to the directory that contain the files of the code: cd compress-and-decompress-files-using-huffman-coding
- Compile the program using the Makefile(Type make in the cmd): make
- Move the text file that you want to compress in the directory that contain the main.c file
- To run the program type: ./huffman -c file1.txt file2.txt
file1.txt: is the name of the file that you want to compress
file2.txt: the name of the file that you want the compressed data will be in it (file2 will be created automatcly you just need to give it a name)
- The run command is: ./huffman -c data.txt output.txt
- The program will create a file names output.txt(depand on the name that you want) and write the huffman tree with the code of the data
- If you want to decompress the file you just need to run the program again using this command: ./huffman -d ouput.txt data1.txt
- I names the file data1.txt just to compare id the data will be the same with my previous data in the file data.txt
- If you have any question contact me at : [email protected]