Hello,
I am currently writing a program that reads in an index of words and searches through a large text file for every instance of that word. I have the tokenize and input working correctly, but I am currently having problems getting my linked list which will consist of the pages it is on to work correctly. I think what its doing is only showing me the last node.
Here are my structures:
Code:
typedef struct stag
{
int pgno ; //page numbers
struct stag *next ; // pointer to next page No
}NODE;
typedef struct
{
string word;
NODE *link ;// pointer to linked list of pgno
}
Here is my portion of code for the linked list:
Code:
if(bin >= 0)//bin is the result of my binsearch
{
p = new(NODE);
p->next = NULL;
p->pgno = pages;//pgno is page number
index.awn[bin].link = p;
}
Any advice would be appreciated.
Thanks.