Thread: help on some vector of custom class code

  1. #1
    cozman
    Guest

    Unhappy help on some vector of custom class code

    vector<BPage> Book;
    int numEntries;

    void Load(string filename)
    {
    ifstream lfile(filename.c_str());
    if(!lfile)
    {
    exit(1);
    }

    BPage tpage;
    string tfname, toname, tlname, tnum, temail, tother, junk;

    lfile >> numEntries; //get the number of entries in the file

    for(int i = 0; i < numEntries; i++)
    {
    lfile >> tfname >> toname >> tlname >> tnum >> temail >> tother >> junk;
    tpage.SetName(tfname, toname, tlname);
    tpage.SetNumber(tnum);
    tpage.SetEmail(temail);
    tpage.SetOther(tother);

    Book[i] = tpage;
    }
    }

  2. #2
    cozman
    Guest

    -

    no need to answer the line in question should have read Book.push_back(tpage);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  3. Default class template problem
    By Elysia in forum C++ Programming
    Replies: 5
    Last Post: 07-11-2008, 08:44 AM
  4. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM