Re:C String Creation
by generic_user on Thursday February 11, 2016 @11:11PM
(#11085242)
These functions are proposed for the next C standard. They are in part 2 of the bounds checking interface. The relevant proposal is n1337 'dynamic allocation functions'
asprintf()
aswprintf()
vaswprintf()
fmemopen()
open_memstream()
open_wmemstream()If you want this today on all (C89) platforms, GLib ships an embedded copy of gnulib and runs virtually everywhere.
gnulib is atrocious beyond belief though. I hear GLib tends to abort your process on OOM, though I haven't done my research on this library, so I would be careful using these to develop reliable software.
Also open_memstream is POSIX 2008, now if it would just get into OS X…