This repository contains a simple command-line program written in C for compressing and decompressing text files. The compression algorithm utilized is based on heap data structures. The program includes two main components: compressor.c
for compressing files and decompressor.c
for decompressing previously compressed files.
Ensure that you have any latest version of C installed on your system.
-
Place your input text file in the same directory as the program files and name it "input_file.txt".
-
Open a terminal or command prompt.
-
Compile the compressor and decompressor programs separately using the following commands:
gcc compressor.c -o compressor gcc decompressor.c -o decompressor
-
Run the compressor on the input file:
./compressor
This will generate a compressed file named "output_file.bin" in the same directory.
-
To decompress the file, run the decompressor:
./decompressor
This will produce the decompressed file named "file-decompressed.txt" in the same directory.
compressor.c
: Source code for the compressor program.decompressor.c
: Source code for the decompressor program.heap.h
: Header file containing necessary data structures and functions for heap operations.
Feel free to contribute to the project by opening issues or submitting pull requests. Feel free to help me get rid of some horrible memory leaks.
Happy compressing and decompressing! 🎉