fmt/fmt/printf.cc

21 lines
558 B
C++
Raw Normal View History

2017-07-15 13:46:18 +00:00
#include "fmt/printf.h"
namespace fmt {
template <typename Char>
void printf(basic_writer<Char> &w, basic_string_view<Char> format, args args);
2017-07-15 13:46:18 +00:00
FMT_FUNC int vfprintf(std::FILE *f, string_view format, printf_args args) {
2017-07-15 13:46:18 +00:00
memory_buffer buffer;
printf(buffer, format, args);
std::size_t size = buffer.size();
return std::fwrite(
buffer.data(), 1, size, f) < size ? -1 : static_cast<int>(size);
}
#ifndef FMT_HEADER_ONLY
2017-09-17 15:32:57 +00:00
template void printf_context<char>::format(buffer &);
template void printf_context<wchar_t>::format(wbuffer &);
2017-07-15 13:46:18 +00:00
#endif
}