Question: The C standard library is notoriously poor when it comes to I/O safety. Many functions have buffer overflows (`gets`, `scanf`), or can clobber memory if not given proper arguments (`scanf`), and so on. Every once in a while, I come across an enterprising hacker who has written his own library that lacks these flaws.

What are the best of these libraries you have seen? Have you used them in production code, and if so, which held up as more than hobby projects?

Answer: 
I use **GLib** library, it has many good standard and non standard functions.

See <https://developer.gnome.org/glib/stable/>

and maybe you fall in love... :)

For example:

<https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup-printf>

explains that **g\_strdup\_printf** is:

> 
> Similar to the standard C sprintf() function but safer, since it calculates the maximum space required and allocates memory to hold the result.
> 
> 
>
For Windows there is a ['safe' C/C++ library](http://msdn.microsoft.com/en-us/magazine/cc163794.aspx).