wprintf - C wchar.h

C examples for wchar.h:wprintf

Type

function

From


<cwchar>
<wchar.h>

Description

Print formatted data to stdout

Prototype

int wprintf (const wchar_t* format, ...);

Parameters

Parameter Description
format format string that follows the same specifications as format in printf

Return Value

On success, the total number of characters written is returned.

On error, a negative number is returned.

Demo Code


#include <wchar.h>

int main()/*ww  w  .  j av a 2 s  .  c om*/
{
   wprintf (L"Characters: %lc %lc \n", L'a', 65);

   wprintf (L"Decimals: %d %ld\n", 2020, 652120L);

   wprintf (L"Preceding with blanks: %10d \n", 2020);

   wprintf (L"Preceding with zeros: %010d \n", 2020);

   wprintf (L"Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);

   wprintf (L"floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);

   wprintf (L"Width trick: %*d \n", 5, 10);

   wprintf (L"%ls \n", L"A wide string");
   return 0;
}

Related Tutorials