#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[ ]){ int i; char ch; FILE *FP; /* if argument is not exist, print error and stop program */ if (argc <= 1){ printf("Please input file name. Try again!\n"); exit(1); } /* check of file existence */ if ((FP = fopen(argv[1], "r")) == NULL){ printf("File not found!\n"); exit(1); } fclose(FP); printf("File Exist!\n"); }
2003年5月3日 13:06 更新