Đọc file text và tạo ra một file từ điển

Mình đang học C++ và thử làm một bài tập đó là đọc dữ liệu từ file text,khi nào tìm được từ mới thì mình lưu lại trong linked list từ đó với số trang,dòng xuất hiện từ đó. Sau khi đọc hết file mình sẽ in ra một file khác. Tuy nhiên khi chạy code thì file mới không có dữ liệu gì mặc dù nó không báo lỗi. Mình đã thử chạy debug và nó báo lỗi như thế này khi chạy đến đoạn

new_node->word = newstr


Đây là code của mình,do mới học nên mình viết chưa gãy gọn,mong mọi người giúp đỡ.

#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <cstring>


using namespace std;
typedef struct dictionary
{
    string word;
    int line;
    int page;
    struct dictionary* next;
} node;
void Append(node** First,string &newstr,int newl,int newp)
{
    node* new_node = (node*)malloc(sizeof(node));
    node* last = *First;
    new_node->word=newstr;
    new_node->line=newl;
    new_node->page=newp;
    new_node->next = 0;
    if(*First == 0)
    {
        *First = new_node;
        return;
    }
    while(last->next != 0)
    {
        last = last->next;
    }
    last->next = new_node;
    return;
}
int Find(node* head,string &tumoi)
{
    node* current = head;
    while(current != 0)
    {
        if(current->word == tumoi)
            return 1;
        current = current->next;
    }
    return 0;
}





int main()
{
    node* Head = NULL;
    ifstream file("filetest.txt");
    if(file.fail())
        cout << "Loi mo file! "<<endl;
    string temp;
    int cpage = 1,cline = 1;
    while(getline(file,temp))
    {
        stringstream spliter;
        spliter << temp;
        vector<string> result;
        while(!spliter.eof())
        {
            string str;
            spliter >> str;
            result.push_back(str);
        }
        for(size_t i = 0;i != result.size();i++)
        {
            if(Find(Head,result[i])==0)
            {
                Append(&Head,result[i],cline,cpage);
            }

        }
        cline++;
        if(cline == 25)
            cpage++;

    }
    file.close();
    ;
    ofstream outfile("test.txt");
    node* p = Head;
    while(p != NULL)
    {
        outfile << p->word <<","<<p->page<<"-"<<p->line<<endl;
        p=p->next;
    }
    outfile.close();


}
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?