putc

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 putc  (  
     int     c,   
     FILE   *fp);
  

Parameters

c
(IN) Specifies the character to be written.
fp
(IN) Points to the file.

Return Values

The putc function or macro returns the character written. If a write error occurs, the error indicator is set and putc returns EOF.

Remarks

The putc function is equivalent to fputc, except that it can be implemented as a macro. The putc function or macro writes the character specified by the argument c to the output stream designated by fp.

See Also

ferror, fopen, fputs, puts

putc Example

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