hi;
how can i copy two files in one file, supposed that each file contain one column of data, into one file without reading variables and put them in another file, ordinary procedure is two read content of each file and put them into another one, which consume much time when dealing with large data, i mean merge two columns side by side in one file, any creative ideas.
Example Inputs : file 1
1
2
3
4
5
6
Example Inputs : file 2
6
5
4
3
2
1
Desired Output : "resulted file"
1 6
2 5
3 4
4 3
5 2
6 1
thanks
What I have tried:
FILE *fptr,*fptr1,*fptr2;
char string1[2000],string2[2000];
fn1.Format("d:\\file_1.txt");
fn2.Format("d:\\file_2.txt");
fn.Format("C:\\file_3.txt");
fopen_s(&fptr,fn1,"rb");
fopen_s(&fptr1,fn2,"rb");
fopen_s(&fptr2,fn,"wb");
while(fgets(string1,sizeof(string1),fptr)!=NULL)
{
fgets(string2,sizeof(string2),fptr1);
fputs (string1,fptr2);
fputs (s"\t",fptr2);
fputs (string2,fptr2);
}
fclose(fptr);
fclose(fptr1);
fclose(fptr2);
note: the two files are the same in length