FILE *fp[]; /* is this possible? */

Doug Gwyn gwyn at smoke.brl.mil
Thu Nov 29 05:15:40 AEST 1990


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
fopen().  Sometimes there is a close relation between these but at other
times there is not, leading to such absurd diagnostics as "Error opening
file: not a tty".



More information about the Comp.lang.c mailing list