Thanks, @Clonk for the quick reply! Appreciate it! If I am not mistaken, the SO answer does the same as my code just with reusing unistd.h instead of writing it "pure Nim". (Isn't my solution more platform independent?)
They are also saving to file. And instead of using reopen() proc, they close() and open() it to access the content. Maybe I am blind, but I feel like the link doesn't answer any of my questions, does it?
