1/* 2 Formatting library for C++ 3 4 Copyright (c) 2012 - 2016, Victor Zverovich 5 All rights reserved. 6 7 For the license information refer to format.h. 8 */ 9 10#include "format.h" 11#include "printf.h" 12 13namespace fmt { 14 15template <typename Char> 16void printf(BasicWriter<Char> &w, BasicCStringRef<Char> format, ArgList args); 17 18FMT_FUNC int fprintf(std::FILE *f, CStringRef format, ArgList args) { 19 MemoryWriter w; 20 printf(w, format, args); 21 std::size_t size = w.size(); 22 return std::fwrite(w.data(), 1, size, f) < size ? -1 : static_cast<int>(size); 23} 24 25#ifndef FMT_HEADER_ONLY 26 27template void PrintfFormatter<char>::format(CStringRef format); 28template void PrintfFormatter<wchar_t>::format(WCStringRef format); 29 30#endif // FMT_HEADER_ONLY 31 32} // namespace fmt 33