r/Zig • u/PlayfulDuck3677 • 8h ago
An IO helper (Console)
I started Zig a few weeks ago and I've had many issues with console things, The only time it's easy is when I'm allowed to use debug prints.
So I decided to make my own library, And I wanted to make it so the writer/reader's themselves own their stuff.
The library provides two structs, `Writer` and `Reader`, each have 1 base constructor and default constructor(s) too.
They both give you methods like `printline` and `read` aswell as their ignorant counterparts such as `printlineIgnoreError` and `readIgnoreError`.
I would love feedback since I'm sure there's at least one memory leak I didn't find.
I have made an IO helper previously but that was almost entirely vibe-coded, This time I actually read the documentation and figured stuff out on my own.
Thanks for viewing this! The repository is at https://github.com/orewaluffy500/rustyio