hello again!
i've been trying different permutations of the code u suggested so now, my prog looks something like that:
#include <stdio.h>
main()
{
FILE *file3 = fopen("f1.dat", "r");
FILE *file4 = fopen("f2.dat", "r");
FILE *file5 = fopen("f3.dat", "w");
int c, d, a, b, ret1, ret2;
ret1 = fscanf(file3, "%d", &a);
ret2 = fscanf(file4, "%d", &b);
while(ret1 && ret2){
if (a >= b){
fprintf(file5, "%d\n", b);
ret2 = fscanf(file4, "%d", &b);
}
else{
fprintf(file5, "%d\n", a);
ret1 = fscanf(file3, "%d", &a);
}
}
if(ret1){
do{
fprintf(file5, "%d\n", a);
ret1 = fscanf(file3, "%d", &a);
}
while(ret1);
}
if(ret2){
do{
fprintf(file5, "%d\n", b);
ret2 = fscanf(file4, "%d", &b);
}
while(ret2);
}
}
************************************************** ***************
I used test values as follows:
f1.dat is 10 20 30 40 50
f2.dat is 15 25 35 45 55 65 75 85
after running the prog, however, i opened f3.dat and found that the values were as follows:
10 15 20 25 30 35 40 45 50 50 50 50...................all the way...
i can't seem to solve the prob...however, if i use the normal !feof way, it works ok... as in if i use
while(!feof(file4))
etc as a condition...
any comments??
Thanks a million!