Compartilhar via


fputc, fputwc (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Writes a character to a stream (fputc, fputwc) or to stdout (_fputchar, _fputwchar).

int fputc(    intc,FILE*stream);wint_t fputwc(    wint_tc,FILE*stream);

Parameters

  • c
    Character to be written
  • stream
    Pointer to FILE structure

Libraries

All versions of the C run-time libraries.

Return Values

Each of these functions returns the character written. For fputc, a return value of EOF indicates an error. For fputwc, a return value of WEOF indicates an error.

Remarks

Each of these functions writes the single character c to a file at the position indicated by the associated file position indicator (if defined) and advances the indicator as appropriate.

In the case of fputc and fputwc, the file is associated with stream. If the file cannot support positioning requests or was opened in append mode, the character is appended to the end of the stream.

Routine-specific remarks follow.

Routine Remarks
fputc Equivalent to putc, but implemented only as a function, rather than as a function and a macro.
fputwc Wide-character version of fputc.

Writes c as a multibyte character or a wide character according to whether stream is opened in text mode or binary mode.

Generic-Text Routine Mappings

TCHAR.H Routine
_fputtc
_fputtchar

For more information about TCHAR.H routines, see Generic Text Mappings.

Example

/* FPUTC.C: This program uses fputc and _fputchar
 * to send a character array to stdout.
 */

#include <stdio.h>

void main( void )
{
   char strptr1[] = "This is a test of fputc!!\n";
   char strptr2[] = "This is a test of _fputchar!!\n";
   char *p;

   /* Print line to stream using fputc. */
   p = strptr1;
   while( (*p != '\0') && fputc( *(p++), stdout ) != EOF ) ;

   /* Print line to stream using _fputchar. */
   p = strptr2;
   while( (*p != '\0') && _fputchar( *(p++) ) != EOF )
      ;
}

Requirements

OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.

See Also

fgetc

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.