Stdio h C Tutorial

Item Value
Header filestdio.h
Declarationint putc(int ch, FILE *stream);
Functionwrites a character to the output stream.
Returnreturns the character written on success and EOF on error.
For binary mode, you can use ferror() to determine whether an error has occurred.

#include 
 
  int main(void){
 
    FILE *fp;
    if((fp=fopen("test", "w"))==NULL) {
      printf("Cannot open file.\n");
      exit(1);
    } 
 
    char *str = "www.rntsoft.com";
 
    for(; *str; str++){
        putc(*str, fp);
    }
  }