Name
      
      fputwc, putwc, putwchar 
      
      
      - write a wide character to a FILE stream
      
      
      
      
         
         Library
      
      
      
      
      libc.lib
      
      
      
      
         
         Synopsis
      
      
      
      
      
      
      
      
         
            |  | wint_t
               
               
               fputwc (wchar_t wc, FILE *stream); 
 | 
      
      
         
            |  | wint_t
               
               
               putwc (wchar_t wc, FILE *stream); 
 | 
      
      
         
            |  | wint_t
               
               
               putwchar (wchar_t wc); 
 | 
      
      
         
         Return values
      
      
      The
      
      
       fputwc,
      
      
       putwc,
      and
      
      
       putwchar
      functions
      return the wide character written.
      If an error occurs, the value
      
      
       WEOF
      is returned.
      
      
      
      
         
         Detailed description
      
      
      The
      
      
       fputwc
      function
      writes the wide character
      
      
       wc
      to the output stream pointed to by
      
      
       stream.
      
      
      
      
         The
         
         
          putwc
         function
         acts essentially identically to
         
         
          fputwc.
         
         
         
      
      
         The
         
         
          putwchar
         function
         is identical to
         
         
          putwc
         with an output stream of
         
         
          stdout.
         
         
         
      
      
         
         Examples
      
      
      
      
      
/* Illustrates how to use putwc API */
#include <stdio.h>
#include <wchar.h>
wint_t example_putwc(void)
{
 FILE *fp = NULL;
 wchar_t wc = L’a’;
 wint_t rval;
 /* opening the file to write*/
 fp = fopen("input.txt","w");
 if(fp == NULL)
 {
  wprintf(L"Error: File open\n");
  return (-1);
 }
/* write a character into fp */
 rval = putwc(wc, fp);
 /* Close the file opened for writing */
 fclose(fp);
 /* return the value that was written */
 return (rval);
}
         
      
      
      
/* Illustrates how to use fputwc API */
#include <stdio.h>
#include <wchar.h>
wint_t example_fputwc(void)
{
 FILE *fp = NULL;
 wchar_t wc = L’a’;
 wint_t rval;
 /* opening the file to write*/
 fp = fopen("input.txt","w");
 if(fp == NULL)
 {
  wprintf(L"Error: File open\n");
  return (-1);
 }
/* write a character into fp */
 rval = fputwc(wc, fp);
 /* Close the file opened for writing */
 fclose(fp);
 /* return the value that was written */
 return (rval);
}
         
      
      
      
/* Illustrates how to use putwchar API */
#include <stdio.h>
#include <wchar.h>
wint_t example_putwchar(void)
{
 wint_t rval;
 wchar_t wc = L’q’;
 
 /* write a character onto the standard output */
 rval = putwchar(wc);
 /* return the character that was written */
 return (rval);
}
         
      
      
      
      
         Output of putwchar
         
         
         
      
q
         
      
         
         
         
      
      
         
         See also
      
      
      
      
      ferror
      
      
      fopen
      
      
      getwc
      
      
      putc
      
      
      Feedback
For additional information or queries on this page send feedback	
      
      
         
         
         
            
               | © 2005-2007 Nokia  | 
 |