HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
p
putc(3S) putc(3S)
[EFBIG] An attempt was made to write to a file that exceeds the process’s file size limit or the
maximum file size (see ulimit(2)).
[EINTR] A signal was caught during the write() system call.
[EIO] A physical I/O error has occurred, or the process is in a background process group and
is attempting to write to its controlling terminal, TOSTOP is set, the process is nei-
ther ignoring nor blocking the SIGTTOU signal, and the process group of the process
is orphaned.
[ENOSPC] There was no free space remaining on the device containing the file.
[EPIPE] An attempt is made to write to a pipe or FIFO that is not open for reading by any pro-
cess. A SIGPIPE signal is also sent to the process.
Additional errno values can be set by the underlying write() function (see write(2)).
WARNINGS
The putc() and putchar() routines are implemented as both library functions and macros. The macro
versions, which are used by default, are defined in <stdio.h>. To obtain the library function either use a
#undef to remove the macro definition or, if compiling in
ANSI-C mode, enclose the function name in
parentheses or use the function address. The following example illustrates each of these methods:
#include <stdio.h>
#undef putc
...
main()
{
int (*put_char()) ();
...
return_val=putc(c,fd);
...
return_val=(putc)(c,fd1);
...
put_char = putchar;
};
Line buffering may cause confusion or malfunctioning of programs that use standard
I/O routines but use
read() themselves to read from standard input. When a large amount of computation is done after print-
ing part of a line on an output terminal, it is necessary to fflush() (see fclose(3S)) the standard output
before beginning the computation.
The macro version of
putc() incorrectly treats the argument stream with side effects. In particular, the
following call may not work as expected:
putc(c, *f++);
The function version of putc() or fputc() should be used instead.
Because of possible differences in word length and byte ordering, files written using putw() are machine-
dependent, and may not be readable by getw() on a different processor.
putw_unlocked() is an obsolescent interface supported only for compatibility with existing DCE appli-
cations. New multithreaded applicationsshould use
putc(), putchar() and putw().
Reentrant Interfaces
If
_REENTRANT is defined, the locked versions of the library functions for putc() and putchar()
are
used by default.
SEE ALSO
fclose(3S), ferror(3S), flockfile(3S), fopen(3S), getc(3S), fread(3S), printf(3S), puts(3S), setbuf(3S), orienta-
tion(5).
STANDARDS CONFORMANCE
putc(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
fputc(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
Section 3730 2 HP-UX Release 11i: December 2000
___
___