wprintf() — Format Data as Wide Characters and Print
Format
#include <stdio.h>
int wprintf(const wchar_t *format,...);
Language Level
ANSI
Threadsafe
Yes
Locale Sensitive
The behavior of this function might be affected by the LC_CTYPE and LC_NUMERIC categories of the current locale. The behavior might also be affected by the LC_UNI_CTYPE and LC_UNI_NUMERIC categories of the current locale if LOCALETYPE(*LOCALEUCS2) or LOCALETYPE(*LOCALEUTF) is specified on the compilation command. This function is not available when LOCALETYPE(*CLD) is specified on the compilation command. For more information, see Understanding CCSIDs and Locales.
Integrated File System Interface
This function is not available when SYSIFCOPT(*NOIFSIO) is specified on the compilation command.
Wide Character Function
See Wide Characters for more information.
Description
A wprintf(format, ...
)
is equivalent to fwprintf(stdout, format, ... )
.
Return Value
The wprintf()
function
returns the number of wide characters transmitted. If an output error
occurred, the wprintf()
function
returns a negative value.
Example
#include <wchar.h>
#include <stdarg.h>
#include <locale.h>
int main(void)
{
setlocale(LC_ALL, "POSIX");
wprintf (L"%c\n", L'a');
return(0);
}
/* A long 'a' is written to stdout */
Related Information
- printf() — Print Formatted Characters
- btowc() — Convert Single Byte to Wide Character
- mbrtowc() — Convert a Multibyte Character to a Wide Character (Restartable)
- 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
- <wchar.h>