链表 - 头部保持为NULL(C ++)

时间:2014-04-16 20:41:53

标签: c++ null linked-list

从文件中读取。问题是NodePTR Ptr得到正确关联但Head仍然NULL

template <typename ElementoPTR, typename Element, typename DetallePTR, typename Detail, typename Node, typename NodePTR>
void Arreglo<ElementoPTR, Element, DetallePTR, Detail, Node, NodePTR>::Registro(ifstream &entrada)
{
NodePTR Ptr = Head;
entrada >> Length;

for (int i = 0; i < Length; i++, Ptr = Ptr->Next) {
    Ptr = new Node;
    entrada >> Ptr->Dealer.CompanyName 
        >> Ptr->Dealer.AmountModels;

    Ptr->Dealer.Modelo = new Detail[Ptr->Dealer.AmountModels];

    for (int j = 0; j < Ptr->Dealer.AmountModels; j++)
        entrada >> Ptr->Dealer.Modelo[j].ModelName >> Ptr->Dealer.Modelo[j].Sales;

    }
}

0 个答案:

没有答案