/****** do_ifile.c Asks for the input file name, if necessary, and opens the file ******/ #include #include FILE *do_infile(int argc, char *argv[], char *linebfr) { FILE *infile; /************************************************************************** Process the INPUT file name and open the file */ if ( argc > 1 ) { strcpy( linebfr, argv[1]) ; } else { printf( "Enter the name of the input text file: "); gets(linebfr); if ( !strlen(linebfr) ) { printf( "You must enter a file name!\n" ); exit(); } } /* Open the header file */ infile = fopen( linebfr, "rt" ); if ( !infile ) { printf( "Can't open input file!\n" ); exit(); } return(infile); }