Code:
#include <stdio.h>
#include <string.h>
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
int main() {
FILE *fptr, *fptw;
fptr=fopen("name.txt","r");
fptw=fopen("new.txt","w");
char cat1[5]; char cat2[5]; char cat3[5];
char buf1[2]; char buf2[2]; char buf3[2]; char buf4[2];
char bbf1[2]; char bbf2[2]; char bbf3[2]; char bbf4[2];
char bbb1[2]; char bbb2[2]; char bbb3[2]; char bbb4[2];
// Get all needed characters from input file, one byte at a time.
fseek(fptr,0, SEEK_SET); fgets(buf1, 2, fptr);
fseek(fptr,2, SEEK_SET); fgets(buf2, 2, fptr);
fseek(fptr,4, SEEK_SET); fgets(buf3, 2, fptr);
fseek(fptr,5, SEEK_SET); fgets(buf4, 2, fptr);
fseek(fptr,6, SEEK_SET); fgets(bbf1, 2, fptr);
fseek(fptr,8, SEEK_SET); fgets(bbf2, 2, fptr);
fseek(fptr,10, SEEK_SET); fgets(bbf3, 2, fptr);
fseek(fptr,11, SEEK_SET); fgets(bbf4, 2, fptr);
fseek(fptr,12, SEEK_SET); fgets(bbb1, 2, fptr);
fseek(fptr,14, SEEK_SET); fgets(bbb2, 2, fptr);
fseek(fptr,16, SEEK_SET); fgets(bbb3, 2, fptr);
fseek(fptr,17, SEEK_SET); fgets(bbb4, 2, fptr);
// conbind characters to create your custom strings.
memcpy(cat1, buf1, 1);
memcpy(cat1+1, buf2, 1);
memcpy(cat1+2, buf3, 1);
memcpy(cat1+3, buf4, 2);
printf("moved %s \n", cat1);
memcpy(cat2, bbf1, 1);
memcpy(cat2+1, bbf2, 1);
memcpy(cat2+2, bbf3, 1);
memcpy(cat2+3, bbf4, 2);
printf("moved %s \n", cat2);
memcpy(cat3, bbb1, 1);
memcpy(cat3+1, bbb2, 1);
memcpy(cat3+2, bbb3, 1);
memcpy(cat3+3, bbb4, 2);
printf("moved %s \n", cat3);
// Write each string to a file.
fputs(cat1, fptw);
fputs(cat2, fptw);
fputs(cat3, fptw);
// out put result to the terminal screen.
printf("buffer1 = %s \n", buf1);
printf("buffer2 = %s \n", buf2);
printf("buffer3 = %s \n", buf3);
printf("buffer4 = %s \n", buf4);
printf("buffer1 = %s \n", bbf1);
printf("buffer2 = %s \n", bbf2);
printf("buffer3 = %s \n", bbf3);
printf("buffer4 = %s \n", bbf4);
printf("buffer1 = %s \n", bbb1);
printf("buffer2 = %s \n", bbb2);
printf("buffer3 = %s \n", bbb3);
printf("buffer4 = %s \n", bbb4);
fclose(fptr);
fclose(fptw);
// All DONE.
return 0;
}