wprintf -- Format Data as Wide Characters and Print

Format

#include <wchar.h>
int wprintf(const wchar_t *format,...);

Language Level: ANSI 93
wprintf(format, ... ) is equivalent to fwprintf(stdout, format, ... ).

For a complete description, see fwprintf -- Format Data as Wide Characters and Write to a Stream.

Return Value
wprintf returns the number of wide characters transmitted.

If an output error occurred, wprintf returns a negative value.

Example
This example prints date and time in the form "Monday, April 14, 17:47" followed by pi to five decimal places. Note that date and time may be formatted according to your locale's representation. The output goes to stdout.

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <wchar.h>
#include <locale.h>
int main(void)
{
   wchar_t *weekday, *month;
   struct tm *newtime;
   time_t ltime;
   struct dtconv *p;
   weekday = (wchar_t *)malloc(sizeof(wchar_t)*20);
   month = (wchar_t *)malloc(sizeof(wchar_t)*20);
   setlocale(LC_ALL,"");
   time(&ltime);
   newtime = localtime(&ltime);
   p = localdtconv();
   mbstowcs(weekday, p->day_names[newtime->tm_wday], sizeof(wchar_t)*20);
   mbstowcs(month, p->month_names[newtime->tm_mon], sizeof(wchar_t)*20);
   wprintf(L"%ls, %ls %d, %.2d:%.2d\n",
            weekday, month, newtime->tm_mday,
            newtime->tm_hour, newtime->tm_min);
   wprintf(L"pi = %.5f\n", 4* atan(1.0));
   return 0;
   /*******************************************************************
      The output should be similar to:
      Monday, April 14, 17:47
      pi = 3.15149
   *******************************************************************/
}



printf -- Print Formatted Characters
btowc -- Convert Single Byte to Wide Character
mbrtowc -- Convert Multibyte Character to Wide Character
vfwprintf -- Format Argument Data as Wide Characters and Write to a Stream
fwprintf -- Format Data as Wide Characters and Write to a Stream
vswprintf -- Format and Write Wide Characters to Buffer
vwprintf -- Format Argument Data as Wide Characters and Print
<wchar.h>