C fputc() function : C Reference




Fputc : Write Single Character to specified Stream


Syntax :

#include<stdio.h>
int fputc(int c, FILE *stream);

c  –  Character Written on Stream
*Stream – File Pointer


What it does ?

  1. fputc outputs a character to a stream
  2. Its Return Value is Character Written on Stream.
  3. If any Error Occures then It returns EOF

Live Example :

#include<stdio.h>

int main(void)
{
char msg[] = "Hellon";
int i = 0;

while (msg[i])
fputc(msg[i++], stdout);
return 0;
}

Output :
       Writes “Hello” Word to File Character by Character


Header File   :  stdio.h


Bookmark & Share