C putc

putc() function is C library function, and it's used to write a character to the file. This function is used for writing a single character in a stream along with that it moves forward the indicator's position.

Syntax:
int putc( int c, FILE * stream );
Example:
int main (void)
{
    FILE * fileName;
    char ch;
    fileName = fopen("anything.txt","wt");
        for (ch = 'D' ; ch <= 'S' ; ch++) {
            putc (ch , fileName);
        }
    fclose (fileName);
    return 0;
}

Scroll Back to Top