December 2005
Beginner to intermediate
618 pages
20h 19m
English
fwprintf
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.
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)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.
Read now
Unlock full access