NAME

putchar - puts a single character out to the given File or to io::Output

SYNOPSIS

putchar(ch)
putchar(file, ch)
file.putchar(ch)

DESCRIPTION

Puts a single character to the given file. If the file is not provided, the character will be written to io::Output. The character ch is always converted to Int. In text-mode, it will write the ch as a UTF-8 sequence. In binary-mode, it will write the ch as an unsigned byte.

RETURN VALUE

None

ERRORS

ArgCheck for an incorrect number of arguments
TypeCheck for a non-File file or non-numeric ch
AccessCheck for an attempt to access a closed file
IoCheck for other miscellaneous I/O errors (see ferror)

EXAMPLE

    // The equivalent of Unix "cat"
    proc main()
    {
        var ch;

        do {
            ch = getchar();
            if (ch != io::EOF) putchar(ch);
        } while (ch != io::EOF);
    }

SEE ALSO

newfile
ferror
getchar