You are browsing as a guest. Sign up (or log in) to start making projects!

File Compressor in C

  • 26 Devlogs
  • 68 Total hours

Writing C file compressor! Two step install guide in the README, enjoy!

Open comments for this post

19m 1s logged

My Ship got rejected… :3d-sad-emoji: kinda

My Ship got requested change because my banner didn’t showcase the project now i changed it, here i compress and decompress a jpeg file and then open it! Hope this next ship will be accepted!

0
0
11
Ship #1

I made a file compressor/decompressor written in C! You can use it on Linux, Windows, and macOS.

The part that took the most time was DEBUGGING. It took SOOOOO much more time than I expected! I’m really proud of finishing the project. I consider this my first full project, so yeah, it took some time, but I finally finished it!

You should know that all the information is in the README (installation, description, etc.). It was really fun working on it, but all good things come to an end!

  • 25 devlogs
  • 68h
  • 12.73x multiplier
  • 863 Stardust
Try project → See source code →
Open comments for this post

1h 58m 34s logged

ITS REALEAAAAAASED

You can use it for Windows, macOS, and Linux. The tutorial is mentioned under the README for all three systems. I tested it on Windows and Linux. I don’t have any Apple devices to test it out. :(

0
0
10
Open comments for this post

2h 56m logged

about the website… :3d-sad-emoji:

So… I abandoned it

I CAN’T MAKE WEBSITES, I CAN’T STAND JAVASCRIPT. I tried to use WebAssembly, but it’s not widely used, so it’s really hard to work with.

How can you use it?

Well, use it with the CLI like a super nerd :nerdy: Don’t worry, everything is documented in the README. CLI » JAVASCRIPT

0
0
10
Open comments for this post

2h 20m 37s logged

Started website, web assembly and my own extension!

Extension

I added the .huff extension since it will help me recognize files compressed by my compressor. The format used is .extension.huff (example: image.jpg.huff).

Web Assembly

I compiled the code to web assembly so it can run directly on the user’s PC and not on servers.

Website

I’m creating a simple website that just does the j*b (still woking on it, this is just the core). The website will not communicate with other APIs or services, thanks to web assembly. I hate JavaScript.

0
0
9
Open comments for this post

7h 45m 36s logged

I reached… the end?

So i’ve been testing for a while now and i didn’t have much to say…. I successfully compressed, decompressed and burnt a linux iso and booted into one ! It required alot of troubleshooting and waiting ( 5 - 15min PER TRY :son-: ) but hey now it works on any file!

0
0
6
Open comments for this post

4h 7m 44s logged

Found the problem for segmentation error (I’m back)

So i had this error for the past 4 days and i coudn’t fix it so i even take a step back for 2 days but still coudn’t find it, the problem was that i had to wait 5 min for every try i did.

Fix ?

I used claude so he run test on faster machines, and i got the errors i have to fix. (He wanted to script it himself, i obviously said no).

0
0
10
Open comments for this post

3h 49m 48s logged

FINALLYYYYYYYYYYYYY

I successfully compressed and decompressed a file other than text files, I used binary to write the files so it supports all the file types now!

What was the problem ?

So the compressed file were written in text and decompressed with text wich limited the compression for only text files.

What was the fix ?

I wrote the compressed file and decompressed in binary.

(small part of the code i changed)

0
0
9
Open comments for this post

2h 2m 51s logged

IT WORKS but only in text files…

Why dosn’t it work?

In the metadata, i write it as a text file (a:1|b:5…), it works fine for text files but for other files type, it dosn’t work since its written in binary.

Any solutions?

i have to write the metadata in binary, yayyy…

0
0
10
Open comments for this post

4h 58m 57s logged

NEVER code something with AI

What happened?

So i said to myself that i can code this small part with AI since i don’t know the synstaxe and I did it and its the problem now. I learned bitwise operators and logique and then recoded the part, didnt finish yet.

0
0
8
Open comments for this post

1h 22m logged

it’s SO HOT in europe

There was an issue with compressor.c while doing it with other files than png. I’m still working on decompressor.c it can’t decode normally a file other than png. Text files still works.

Heatwave

Its so hot in europe, I can’t work normally, the temperatures will go down monday hopefully.

0
0
7
Open comments for this post

2h 34m 58s logged

FINALLY FINISHED compressor.c AND decompressor.c

THE BUG

so the main bug was that the two arrays which contained the frequencies of each letter were reversed so the huffman tree was not the same and the codes too weren’t the same.

THE FIX

so in decompressor.c i just reversed the codes. this is not a permanent fix will investigate further into compressor.c to see why its reversed!

0
0
5
Open comments for this post

3h 11m 26s logged

Fixed swapping issues, transfer list array into node array, and building codes works

Swapping issues

i had an issue where i was putting the new node in first in the link list so i fix it, drawing it on a sketch really helped.

Transfer list to node

So i transfer it into an array since its easier to use it and i coudn’t built it before since an array is a fixed size, thats why I used a linked list to first get the values and the length.

Building huffman codes

I just imported function i already programmed in compressor.c.

image from wikipedia

0
0
34
Open comments for this post

1h 21m 11s logged

C programmer TOUCHING grass for the FIRST TIME

I didnt program for 2 days and touched some grass.

How was it ?

it was weird since it was grass (wich i don’t touch) but it was ok.

btw it was fake grass

8
4
3442
Open comments for this post

54m 46s logged

why are we only using I in loops?

its a real question why only I ? I used f it was so cool.
Use other letters for your loops. I’m onto something guys, it’s the next big thing.

P.S: I’m going to take a break from coding in C since its pretty anoying and im not really doing anything while working maybe this challenge is really too hard for me.
I’m maybe going to start another project then see.

0
0
38
Open comments for this post

2h 10m 40s logged

FINISHED COMPRESSOR.C

Finnaly finished compressor.c after 7 hours on it!

How did it did it ?

Well i used AI… Yes I’m not proud but hey its finished!
I was really tired and I just vibe coded it but now no more AI for decompressor.c !

Did i learn something?

Yes i didn’t blindly ask AI do give answers i asked to help debug the code!

What do i do next?

Probably sleep, I’m so tired.

0
0
31
Open comments for this post

1h 29m 17s logged

Building huffman code tree

Finally finished coding everything but the tree.

I can finally code without AI

so for relearning, i authorized myself to use AI but only to debug, now i can finally not use it (since i relearned C)

Problems

I ran into several problems:

  • Segmentation problems, i was accessing things i normally can’t
  • Future problem, i can’t name something with more than two carrecters so when i’m merging two nodes i can’t rename thoses.
0
0
27
Open comments for this post

3h 46m 8s logged

FINALLY FIXED SEGMENTATION PROBLEMS

For context i was building the compressor and i had segmentation problems

What is a segmentation problem?

A segmentation problem is when you try and access memory your don’t have access.

What was the problems?

  • First the allocation, i didnt allocate for the array of pointers to my struct.
  • Didnt check for NULL, so my arrays have 256 nodes (for all of the ASCII values) and i was trying to access values that just didnt existed.

How did i fix it?

I used AI to debug my code, I didnt directly asked for the awnsers, i asked it to help me without giving out awnsers. AI was very useful since i mad alot of small mistakes since i didnt program in C for a long time.

0
0
24
Open comments for this post

4h 17m 3s logged

CS50x C Refresher

Redid one exercise from CS50x Psets 2, 3, 4, and 5.

I wanted to refresh my C programming skills because after Week 5 the course shifts more toward web applications, databases, and other topics. This was a good way to get back into writing C before continuing work on Stardance.

2
1
61
Open comments for this post

15m 55s logged

Studying Huffman Coding

Huffman Coding is a lossless compression algorithm.

Example text: ffffcdabdfdeeebcc

First, count how often each character appears:

f:4 c:3 d:3 e:3 b:2 a:1

Then repeatedly merge the least frequent characters into a binary tree until one final tree remains.

Each character gets a binary code:

  • Left = 0
  • Right = 1

More frequent characters receive shorter codes, reducing the total file size.

A key rule: no code can start with another code.
If f = 1, then 100 cannot be another character, so decoding stays unambiguous.

Time complexity: O(n log n)

Image: GeeksforGeeks
Video: Computerphile – Huffman Coding

0
1
75

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…