I'm afraid I can't help you with txt_for_dir(). Someone else want to pitch in?

Anyways, I can help you with memset(). It's a function from the C standard library and it sets the content of a given memory block to the given constant. In the example case it was set to 0, so the block of memory was zeroed out. It's short than the for loop, and potentially faster: Usually the library shipped with the system has an optimized version for your CPU, which takes advantage of the big guns in the instruction set (in the case of modern x86 CPUs this means it uses AVX to store 512bits at once)


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com