Question about perror
Doug Gwyn
gwyn at smoke.brl.mil
Fri Nov 30 21:08:55 AEST 1990
In article <4573 at oasys.dt.navy.mil> stuart at oasys.dt.navy.mil (Stuart Pearlman) writes:
>Is perror() specified in the ansi C standard? I avoid using perror()
>after library routines such as fopen() because they can fail for other
>reasons besides the system calls they make failing. Are any of the
>library functions specified in the standard guaranteed to set errno?
>(Is errno even guaranteed to exist?) What about posix 1003.1? Does
>it specify what functions you can call perror() after?
perror() is required for ANSI C conformance. errno is required, but
only a few of the standard functions (mainly math functions) are
required to set errno (upon certain conditions). IEEE Std 1003.1
specifies that errno is to be set for error returns from a large
number of functions (mainly those normally implemented on UNIX as
genuine system calls). The allowable values of errno (<errno.h>
macros) are specified for each function.
More information about the Comp.lang.c
mailing list