Name
fwprintf
Synopsis
Writes formatted output in a wide-character string to a file
#include <stdio.h> #include <wchar.h> intfwprintf
( FILE * restrictfp
, const wchar_t * restrictformat
, ... );
The fwprintf()
function is
similar to fprintf()
, except that
its format string argument and its output are strings of wide
characters.
Example
wchar_t name_local[ ] = L"Ka\u0142u\u017Cny"; char name_portable[ ]= "Kaluzny"; char locale[ ] = "pl_PL.UTF-8"; char * newlocale; newlocale = setlocale( LC_ALL, locale ); if ( newlocale == NULL ) fprintf( stderr, "Sorry, couldn't change the locale to %s.\n" "The current locale is %s.\n", locale, setlocale( LC_ALL, NULL )); fwprintf( stdout, L"Customer's name: %ls (Single-byte transliteration: %s)\n", name_local, name_portable );
If the specified Polish locale is available, this example produces the output:
Customer's name: Kałużny (Single-byte transliteration: Kaluzny)
See Also
The byte-character output function fprintf()
; the
wide-character input functions fgetwc
, fgetws
, getwc
, getwchar
, fwscanf
, wscanf
, vfwscanf
, and vwscanf
; the wide-character output
functions fputwc
, fputws
, putwc
, putwchar
, wprintf
, vfwprintf
, and vwprintf
.
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.