redirecting output

Henry Spencer henry at zoo.toronto.edu
Wed Jul 4 03:11:51 AEST 1990


In article <JID4B=4 at ficc.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
>While picking nits, how about doing it right. There's really no excuse for
>not calling perror...

Yes there is:  it doesn't do what I want, which is a more informative
message about the high-level nature of the problem.  A major reason why
perror() doesn't get used is that it is simply too inflexible:  it takes
too much extra work to put together a useful message, since that generally
requires assembling an argument string out of pieces.  One often wants
more information than just the filename and the error code.  Something
like the Kernighan&Pike error() function is vastly more useful, but alas,
not everyone has it.  If you're willing to rely on ANSI C facilities (or
imitations of same, e.g. my old strings package), then strerror() can
be used to get much the same effect.
-- 
"Either NFS must be scrapped or NFS    | Henry Spencer at U of Toronto Zoology
must be changed."  -John K. Ousterhout |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list