if((fp2=fopen(argv[2],"w")) == NULL){
->
if((fp2=fopen(argv[2],"wb")) == NULL){



fprintf(fp2,"%d\n",c);
->
fprintf(fp2,"%d\x0A",c);