C examples for wchar.h:fputws
function
<cwchar> <wchar.h>
Write wide string to stream
int fputws (const wchar_t* ws, FILE* stream);
Parameter | Description |
---|---|
ws | C wide string. |
stream | Pointer to a FILE object |
On success, a non-negative value is returned.
If a multibyte character encoding error occurs, errno is set to EILSEQ and EOF is returned.
If a writing error occurs, the function sets the error indicator (ferror) and returns EOF.
#include <stdio.h> int main ()/* www. j a v a 2 s. c om*/ { FILE * pFile; wchar_t sentence [256]; wprintf (L"Enter sentence to append: "); fgetws (sentence,255,stdin); pFile = fopen ("mylog.txt","a"); fputws (sentence,pFile); fclose (pFile); return 0; }