NAME

putc, putchar, fputc, - put character on a stream

SYNOPSIS

#include <stdio.h>

int putc(int c , FILE *stream );
int putchar(int c );
int fputc(int c , FILE *stream );

DESCRIPTION

putc() writes c (converted to an unsigned char) onto the output stream at the position where the file pointer (if defined) is pointing, and advances the file pointer appropriately. If the file cannot support positioning requests, or stream was opened with append mode, the character is appended to the output stream. putchar(c) is defined as putc(c, stdout). putchar() is a macro.

fputc() behaves like putc(). .

RETURN VALUES

On success, putc(), fputc(), and putchar() return the value that was written. On error, these functions return the constant EOF and set errno to indicate the error.

Failure will occur, for example, if the file stream is not open for writing or if the output file cannot grow.

ERRORS

These functions are members of Unison's STDIO implementation. The STDIO implementation rests on top of IOLIB and inherits IOLIB's dependency on each specific server to report an appropriate error code for its usage.

For an exact list of error codes returned by a particular server, refer to that server's documentation in the Unison Programmer's Guide for each specific platform.

Servers may implement these errors codes in response to these functions.

[EAGAIN]
The O_NONBLOCK flag is set for the file descriptor underlying stream and the thread would be delayed in the write operation.
[EBADF]
The file descriptor underlying stream is not a valid file descriptor open for writing.
[EFBIG]
An attempt was made to write to a file that exceeds the maximum file size.
[EIO]
A physical I/O error has occurred, or the process is a member of a background process group attempting to write to its controlling terminal, TOSTOP is set, the process is neither ignoring nor blocking SIGTTOU, and the process group of the process is orphaned. This error may also be returned under implementation-defined conditions.
[ENOSPC]
There was no free space remaining on the device containing the file.
[ENOMEM]
Insufficient storage space is available.
[ENXIO]
A request was made of a nonexistent device, or the request was outside the capabilities of the device.

SEE ALSO

write(), fclose(), ferror(), fopen(), printf(), puts(), setbuf()


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2011 >