putchar()

Declaration

int putchar(int iChar);

Description:

This function writes an ASCII character "iChar" to a the standard output stream "stdout." If successful, the function returns the value of the written character. Otherwise, it returns EOF to indicate an error or end-fo-file condition.

Example

#include <cstdio>

int main()
{
    // Write an ASCII character to "stdout"
    int iRet = putchar('X');
    // Check the put was successful
    if (iRet != EOF) {
        printf("\nCharacter written: %c\n", (char)iRet);
    }

    return 0;
}

Output:

putchar() Output