I need a C function which returns the final length of a formatted string so I can properly allocate the target string, rather than calculate the length myself. There is snprintf
which does just this upon inability to write the entire string, but unfortunately there is no wide char alternative for it.
swprintf
returns -1 in case of error, not the needed length (why not the same behaviour ?!?)
The title mentioned asprintf
seems to be of no help also, as it provides a non-wide version only.
_vscwprintf
can be used on windows, but I need a crossplatform, standard version, or at least a Linux version and I'll #ifdef the code.
Any ideas? Thanks!