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 that uses wprintf()

This example prints the wide character a. Date and time may be formatted according to your locale's representation. The output goes to stdout.

#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



[ Top of Page | Previous Page | Next Page | Contents | Index ]