wprintf is a C standard library function as defined in wchar.h. It has function signature as

int wprintf(const wchar t *format,...);

The wprintf() writes output to stdout, the standard output stream. It uses variable argument lists. This function and also functions like vprintf, vfprintf, vsprintf, vsnprintf, and vasprintf offer the ability for programmers to essentially create their own printf variants.

Usage edit

The wprintf function is found in C, in which writes the output to the stream under control of format strings. the format string specifies how subsequent arguments are converted for output.

wprintf is a wide character version of printf format. The format is a wide character string where wprintf and printf bahave similarly as they are opened in ANSI mode.

Example edit

Following is the sample code for understanding of working of the wprintf.

code:

#include<stdio.h>
#include<wchar.h>
int main(int argc,char *argv[])
{
      wchar_t *str = L"@TAJMAHAL@#$$$";
      wprintf(L"%ls\n", str);
      return EXIT_SUCCESS;
}

After running the code output will be as follows:

@TAJMAHAL@#$$$

Limitations edit

limitations:
1. wprintf() is not portable function.
2. wprintf() cannot be mixed with printf().
3. wprintf cannot print the double values.

  for eg. 2^56 is the double value which cannot be printed using wprintf().