Created
May 6, 2011 15:28
-
-
Save idlecool/959157 to your computer and use it in GitHub Desktop.
Merge two corrupt files (one at front and another at rear) into one neat file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void main() | |
{ | |
FILE *ifp1, *ifp2, *ofp; | |
int limit, pointer=0; | |
int current_char, junkchar; | |
limit = 300*1024; // 300KB | |
ifp1 = fopen("eclipse-java-helios-SR2-linux-gtk2","r"); | |
ifp2 = fopen("eclipse-java-helios-SR2-linux-gtk","r"); | |
ofp = fopen("eclipse-java-helios-SR2-linux-gtk.tar.gz","w"); | |
while(1) | |
{ | |
if (pointer<limit) | |
{ | |
current_char = fgetc(ifp1); | |
junkchar = fgetc(ifp2); | |
} | |
else | |
{ | |
current_char = fgetc(ifp2); | |
} | |
if (current_char==EOF) | |
{ | |
break; | |
} | |
fputc(current_char, ofp); | |
pointer++; | |
} | |
fclose(ifp1); | |
fclose(ifp2); | |
fclose(ofp); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment