Why cannot read 2 file in the same time?

I want to read the position of a word from file1 with position of an occurrence from file2. and put both data in linked list. But I cannot read multiple file in same time.
example:
File1 File2
quality -------> 1
computer -------> 5
human -------> 2

Could someone tell me why I can't read 2 file in the same time?

My code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
     FILE *pFile1,*pFile2;
     pFile1 = fopen ("unique.txt","r+");
     pFile2 = fopen ("frequency.txt","r+");     
     rewind (pFile1);
     rewind (pFile2);
     
     while((!feof(pFile1))&&(!feof(pFile2))){
        ptrNew = (struct ds*) malloc(sizeof(struct ds));
          if (ptrFirst == (struct ds*)NULL)                   
             ptrFirst = ptrThis = ptrNew;
          else{                                             
              ptrThis = ptrFirst;
              while ((ptrThis -> ptrNext != (struct ds*)NULL))
                    ptrThis = ptrThis -> ptrNext;
              ptrThis -> ptrNext = ptrNew;                    
              ptrThis = ptrNew;                                
          }
          
          fscanf(pFile1,"%s",ptrThis -> data);
          fscanf(pFile2,"%s",ptrThis -> word_count);
          fflush (stdin);         
          ptrThis -> ptrNext = (struct ds*)NULL;
          
     }
     fclose(pFile2); fclose(pFile1);
Topic archived. No new replies allowed.