C examples for wchar.h:putwc
function
<cwchar> <wchar.h>
wint_t putwc (wchar_t wc, FILE* stream);
Write wide character to stream
Parameter | Description |
---|---|
wc | The wide character to write. |
stream | Pointer to a FILE object |
On success, the character written is returned.
On error, it returns WEOF.
#include <stdio.h> int main ()// w w w . j a v a2 s . c o m { FILE * pFile; wchar_t wc; pFile = fopen ("example.txt","w"); if (pFile!=NULL) { perror("cannot open file"); return -1; } for (wc = L'A' ; wc <= L'Z' ; ++wc) putwc ( wc , pFile ); fclose (pFile); return 0; }