fputws - C wchar.h

C examples for wchar.h:fputws

Type

function

From


<cwchar>
<wchar.h>

Description

Write wide string to stream

Prototype

int fputws (const wchar_t* ws, FILE* stream);

Parameters

Parameter Description
ws C wide string.
stream Pointer to a FILE object

Return Value

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.

Demo Code


#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;
}

Related Tutorials