/* link this with sortfile from 1.c */ #include #include int main() { char inname[80], outname[80], *p; FILE *infp, *outfp; extern void sortfile(FILE *in, FILE *out); printf("Input file: "); fgets(inname, sizeof inname, stdin); if ((p = strchr(inname, '\n')) != NULL) *p = '\0'; if ((infp = fopen(inname, "r")) == NULL) { perror(inname); return 1; } printf("Output file: "); fgets(outname, sizeof outname, stdin); if ((p = strchr(outname, '\n')) != NULL) *p = '\0'; if ((outfp = fopen(outname, "w")) == NULL) { perror(outname); return 1; } sortfile(infp, outfp); return 0; }