#include <stdio.h> #include <conio.h> #include <stdlib.h>
int main(int argc, char *argv[]) { char ch; long pos; FILE *infp; FILE *outfp; ch=0; if(argc !=3) { printf("Data file name missing!"); exit(-1); } if((infp=fopen (argv[1], "rb"))==NULL) { printf("cannot fileopen"); exit(-1); } if((outfp = fopen (argv[2], "wb"))==NULL) { printf("cnanot file create"); exit(-1); } while(fgetc (infp)!= '\n'); pos=ftell(infp); while(ch!= '\n') { fseek (infp, pos++, SEEK_SET); ch = fgetc(infp); putch(ch); fputc (ch, outfp); } return 0; }
|