FILE *fp[]; /* is this possible? */
Clarence Dold
dold at mitisft.Convergent.COM
Fri Nov 30 03:00:26 AEST 1990
in article <14603 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) says:
> In article <1990Nov28.152146.19560 at ssd.kodak.com> weimer at ssd.kodak.com (Gary Weimer) writes:
>> if ((fp[i]=fopen(file_name[i],"r+")) <= 0)
>> perror("Error opening file");
> Please don't do this; on UNIX, perror() will report the reason for the last
> SYSTEM CALL failure, not the reason for failure of a library routine such as
Quoth my man page, perror(3c):
"... last error encountered during a call to a system or library function..."
The most common coding error in this area is to check errno after calling
a function, without checking for an error return from the function, resulting
in retrieval of some earlier errno, not associated with more recent calls.
--
---
Clarence A Dold - dold at tsmiti.Convergent.COM (408) 435-5293
...pyramid!ctnews!tsmiti!dold FAX (408) 435-3105
P.O.Box 6685, San Jose, CA 95150-6685 MS#10-007
More information about the Comp.lang.c
mailing list