ILE C/C++ Run-Time Library Functions


vwprintf() -- Format Argument Data as Wide Characters and Print

Format

#include <stdarg.h>
#include <wchar.h>
int vwprintf(const wchar_t *format, va_list arg);

Language Level: ANSI

Threadsafe: Yes.

Description

The vwprintf() function is equivalent to the wprintf() function, except that the variable argument list is replaced by arg, which the va_start macro (and possibly subsequent va_arg calls) will have initialized. The vwprintf() function does not invoke the va_end macro.

Note:
This function is available when SYSIFCOPT(*IFSIO) is specified on the compilation command, and LOCALETYPE(*CLD) is not specified on the compilation command.

Return Value

The vwprintf() function returns the number of wide characters transmitted. If an output error occurred, thevwprintf() returns a negative value.

Example that uses vwprintf()

This example prints the wide character a. The printing is done from the vout() function, which takes a variable number of arguments and uses the vwprintf()function to print them to stdout.


#include <wchar.h> 
#include <stdarg.h> 
#include <locale.h> 
 
void vout (wchar_t *fmt, ...); 
 
const char ifs_path[] = "tmp/mytest"; 
 
int main(void)     { 
 FILE *stream; 
 wchar_t format[] = L"%lc"; 
 setlocale(LC_ALL, "POSIX"); 
 vout (format, L'a'); 
return(0); 
 
/* A long a is written to stdout, if stdout is written to the screen
   it may get converted back to a single byte 'a'.  */ 
} 
 
 void vout (wchar_t *fmt, ...) { 
 
 va_list arg_ptr; 
 va_start (arg_ptr, fmt); 
 vwprintf (fmt, arg_ptr); 
 va_end (arg_ptr); 
} 

Related Information


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