6.23.20 putwc Function
Writes a wide character to a stream.
Attention: This function is implemented
only by MPLAB XC32 C compilers.
Include
<wchar.h>
Prototype
wint_t putwc(wchar_t c, FILE * stream);
Arguments
c
- the wide character to write
stream
- the stream to write to
Return Value
The function returns a copy of the wide character written. If a write or encoding error
occurs, WEOF
is returned.
Remarks
The putwc()
function is equivalent to fputwc()
.
Example
#include <wchar.h>
#include <stdio.h>
int main(void)
{
FILE * myfile;
wint_t wc;
if ((myfile = fopen("afile", "w")) == NULL)
wprintf(L"Cannot open afile\n");
else
{
for(wc = L'0'; iswdigit(wc); wc++)
putwc(wc, myfile);
fclose(myfile);
}
}
Example Output
Content of afile
.
0123456789