6.23.10 fputws Function
Writes a wide string to a stream.
Attention: This function is implemented
only by MPLAB XC32 C compilers.
Include
<wchar.h>
Prototype
int fputws(const wchar_t * restrict s, FILE * stream);
Arguments
s
- the wide string to write
stream
- the stream to write to
Return Value
The function returns a non-negative number. If a write or encoding error occurs, it return
EOF
.
Remarks
The function writes the wide string, s, to the output stream pointed to by stream. The null wide character terminating the wide string is not written.
Example
#include <wchar.h>
#include <stdio.h>
int main(void)
{
FILE * myfile;
wchar_t ws[] = L"One string 4 all";
if ((myfile = fopen("afile", "w")) == NULL)
wprintf(L"Cannot open afile\n");
else
{
fputws(ws, myfile);
fclose(myfile);
}
}
Example Output
Content of afile
.
One string 4 all