I need a C function that returns the final length of a formatted string so that I can correctly select the target string and not calculate the length myself. There is snprintf that does this only when it is not possible to write the entire string, but unfortunately there is no wide alternative to char for it.
swprintf returns -1 in case of an error, and not the required length (why not the same behavior?!?)
The name mentioned by asprintf also does not help, as it provides only a narrow version.
_vscwprintf can be used on Windows, but I need a cross-platform, standard version, or at least a version for Linux, and I will #ifdef the code.
Any ideas? Thanks!
gheorghe1800
source share