putchar, putwchar (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 stdout.

int putchar(    intc);wint_t putwchar(    wint_tc);

Parameters

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

Return Values

Each function returns the character written.

To indicate an error or end-of-file condition, putchar returns EOF; putwchar returns WEOF.

For both routines, use ferror or feof to check for an error or end of file.

Remarks

For each routine, if a read error occurs, the error indicator for the stream is set.

putchar is similar to _fputchar, but is implemented both as a function and as a macro.

putwchar is the wide-character version of putchar.

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE Defined
_puttc putwc
_puttchar putwchar

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

Example

/* PUTC.C: This program uses putc to write buffer
 * to a stream. If an error occurs, the program
 * stops before writing the entire buffer.
 */

#include <stdio.h>

void main( void )
{
   FILE *stream;
   char *p, buffer[] = "This is the line of output\n";
   int  ch;

   ch = 0;
   /* Make standard out the stream and write to it. */
   stream = stdout;
   for( p = buffer; (ch != EOF) && (*p != '\0'); p++ )
      ch = putc( *p, stream );
}

Output

This is the line of output

Requirements

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

See Also

fputc

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.