Posts

Showing posts with the label printf

Why vsnwprintf missing

Why vsnwprintf missing I using vsnprintf for ansi string and it works well, returns -1 only on error and returns count of needen size if it does not fit into buffer. I need same function for wide strings, vsnwprintf just not exists. I also tried _vsnwprintf , but it acts really different, it returns -1 even if buffer too small, while I need to know how much to expand a buffer, but only when it's necessary, I don't want to make dummy calls just to determine needen size and only then expand a buffer. vsnprintf -1 vsnwprintf _vsnwprintf If look at vsnprintf code: vsnprintf int const _Result = __stdio_common_vsprintf( _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Buffer, _BufferCount, _Format, NULL, _ArgList); return _Result < 0 ? -1 : _Result; While _vsnwprintf approximately has: int const _Result = __stdio_common_vswprintf( _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _B...