Using fseek with a file pointer that points to stdin
问题 Depending on command-line arguments, I\'m setting a file pointer to point either towards a specified file or stdin (for the purpose of piping). I then pass this pointer around to a number of different functions to read from the file. Here is the function for getting the file pointer: FILE *getFile(int argc, char *argv[]) { FILE *myFile = NULL; if (argc == 2) { myFile = fopen(argv[1], \"r\"); if (myFile == NULL) fprintf(stderr, \"File \\\"%s\\\" not found\\n\", argv[1]); } else myFile = stdin;