// filename:c2011-7-29-2-5-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 7.29.2.5 The vfwprintf function // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. // Example #include #include #include void error(char *function_name, wchar_t *format, ...) { va_list args; va_start(args, format); // print out name of function causing error fwprintf(stderr, L"ERROR in %s: ", function_name); // print out remainder of message vfwprintf(stderr, format, args); va_end(args); } int main(void) { error("main", L"%s","help me\n","test"); return printf("7.29.2.5 The vfwprintf function\n"); } // output may be // ERROR in main: help me // 7.29.2.5 The vfwprintf function