putchar

Writes a character to the output stream (function or macro)

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
   
  int putchar  (  
     int   c);
  

Parameters

c
(IN) Specifies the character to be written.

Return Values

This function or macro returns the character written. If a write error occurs, the error indicator is set and putchar returns EOF. If an error occurs, errno is set.

Remarks

The putchar function or macro writes the character specified by the argument c to the output stream stdout.

The function is equivalent to:

     fputc (c, stdout);
  

See Also

fputc, fputs

putchar Example

  #include <stdio.h>  
   
  main ()  
  {  
     FILE   *fp;  
     int     c;  
     fp = fopen ("data.fil", "r");  
     c = fgetc (fp);  
     while (c != EOF)  
     {  
        putchar (c);  
        c = fgetc (fp);  
     };  
     fclose (fp);  
  }