#include <stdio.h> #include <stdlib.h> main(argc, argv) int argc; char *argv[]; { FILE *fp; fp = fopen(argv[1], "r"); /* Open an input file. */ if (fp == NULL) { /* If the fopen call failed, perror prints out a */ /* diagnostic: */ /* */ /* "open: <error message>" */ /* This error message provides a diagnostic explaining */ /* the cause of the failure. */ perror("open"); exit(EXIT_FAILURE); } else fclose(fd) ; }