I'm wondering if there is a good and portable way to automatically resize buffers in C, particularly when using vsprintf.
I'm considering asprintf and vasprintf, but I'd rather use alloca than malloc so I don't have to free() stuff myself, unless someone knows of an easy way to automatically free memory the moment it gets out of scope.
I guess it's also an option to make the code c++ compatible and using c++'s string library? I've never gone that route before so I'm not sure how much work that'd entail.
Depending on what you're actually doing with this, you might want to also look into streams, like string-backed streams (osstream or ostrstream, IIRC, depending on which version of the STL you're using).