fputwc - C wchar.h

C examples for wchar.h:fputwc

Type

function

From


<cwchar>
<wchar.h>

Description

Write wide character to stream

Prototype

wint_t fputwc (wchar_t wc, FILE * stream);

Parameters

Parameter Description
wc The wide character to write.
stream Pointer to a FILE object

Return Value

On success, the character written is returned.

Demo Code

#include <stdio.h>

int main ()/*  w w  w  .  ja  v a  2s . com*/
{
  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)
      fputwc ( wc , pFile );

  fclose (pFile);

  return 0;
}

Related Tutorials