Skip to content

Instantly share code, notes, and snippets.

@Const-me
Created December 8, 2019 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Const-me/f1bb320969adde6c79694265ea644b9d to your computer and use it in GitHub Desktop.
Save Const-me/f1bb320969adde6c79694265ea644b9d to your computer and use it in GitHub Desktop.
template <template <typename, typename> class Base, typename Character>
static int __cdecl common_vfprintf(
unsigned __int64 const options,
FILE* const stream,
Character const* const format,
_locale_t const locale,
va_list const arglist
) throw()
{
typedef output_processor<
Character,
stream_output_adapter<Character>,
Base<Character, stream_output_adapter<Character>>
> processor_type;
_VALIDATE_RETURN(stream != nullptr, EINVAL, -1);
_VALIDATE_RETURN(format != nullptr, EINVAL, -1);
return __acrt_lock_stream_and_call(stream, [&]() -> int
{
__acrt_stdio_temporary_buffering_guard const buffering(stream);
_LocaleUpdate locale_update(locale);
processor_type processor(
stream_output_adapter<Character>(stream),
options,
format,
locale_update.GetLocaleT(),
arglist);
return processor.process();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment