Xen's personal web-page

My maintained projects, documentation, scripts, tips, and sometimes my thoughts... all here.

READING MODE OFF

Posts in Tag: "Binary"

Toying with Binary files in C

I noticed a lot of devs these days relay heavily on text or JSON files to store data/settings instead of using binary files. This maybe due to thinking that dealing with binary files are hard or requires deep knowledge in low level languages, which is false. Binary files are very similar to arrays of structures, except the structures are in a disk file rather than in an array in memory. Because the structures in a binary file are on disk, you can create very large collections of them (limited only by your available disk space). They are also permanent and always available. The only disadvantage is the slowness that comes from disk access time. more

How to make GCC/Clang produce a very small executable

Sometimes size matters! especially if you’re working with medium/big projects that will produce a gigantic executables. Well… Here’s my secret sauce to make compilers generate very small files + another trick that you may not know about. First of all let’s make a small program to test our new compiling flags, you can make your own or just use this code i made for this experiment: more