/* Partition of File/* #include <stdio.h> #include <stdlib.h> #include <string.h> #define &NBSP;NUM&NBSP;1024 * 1024 * 100int main () { // Required split file path File *fr = fopen ("F:\\pl.exe", "RB");if (Fr == null) {exit (-1);} char *buff = (char*) malloc (sizeof (char) * num);if (buff == null) {exit ( -2);} size_t rs = 0; File *fw;// = fopen ("F:\\1.exe", "WB");//The partitioned file is cycled to the target path char str[100] = "F : \ \ "; char tmp_file[100];char name[100];int i = 1;while ((rs = fread (Buff,sizeof (char), NUM,&NBSP;FR)) ( > 0) {// sprintfitoa (i,name,10);// i->1-->name--> "1" strcpy (TMP_FILE,&NBSP;STR);// tmp_file ->> "F : \ \ "Strcat (tmp_file,name);// f:\\1strcat (tmp_file, ". exe "); fw&Nbsp;= fopen (tmp_file, "WB"); Fwrite (buff,sizeof (char) &NBSP;,RS,&NBSP;FW); fclose (fw); i++;} Fclose (FR); return 0;} /* File Merge */#include <stdio.h> #include <stdlib.h> #include <string.h> #define num 1024* 1024*100// 10mbint main () {File *fr1 = fopen ("F:\\1.exe", "RB"); // The segmented file path File *fr2 = fopen ("F:\\2.exe", "RB"); File *fw = fopen ("F:\\meger.exe", "WB");//target path after file merge char *buff = (char*) malloc (sizeof (char) * num);//size_t rs = 0; file *arr[] = {fr1,fr2};for (int i=0;i<2;i++) {while (Rs = fread (Buff, sizeof (char), Num, arr[i])) ( > 0) {fwrite (buff, sizeof (char), &NBSP;RS,&NBSP;FW);} Fclose (Arr[i]);} Fclose (FW); free (buff); return 0;}
Splitting and merging of files