codescracker


c

C putc()



« Previous Function Next Function »


putc()

The putc() function writes the character contained in least significant byte of ch to the output stream pointed to by stream. Because the character arguments are elevated to integer at the time of call, you can use the character values as the arguments to putc(). putc() is often implemented as a macro.

putc() Syntax

#include<stdio.h>
int putc(int ch, FILE *stream);

The putc() function returns the character written if successful, otherwise EOF if an error occurs.

putc() Example

Following loop writes the characters in the string str to the stream specified by fp. The null terminator is not written :

for(; *str; str++)
{
	putc(*str, fp);
}

« Previous Function Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test