so i've got my write function to work that saves the file.
But i can't wrap my mind around the best way to do the oposite when the program starts, i'll post what i have! If it helps i'm trying to load data of "BillData" types into a variable, take it's member's and read them into the accessor for the vector?(InsertBill) of BillList (m_TheList),Code:... fout.open("list.bin", std::ios::binary); for (int i = 0; i < m_TheList->getSize();i++){ BillData billdat = m_TheList->getDat(i); fout.write((char*) &billdat, sizeof billdat); } fout.close(); ...
Code:fin.open("list.bin", std::ios::binary); //Load the list of bills. if (fin){ // if the file was found. //BillData *temp = new BillData(fin.read((char *) &temp, sizeof temp)); // fin.read(&temp, sizeof temp); //temp = fin.read(char *) &temp, sizeof temp); m_TheList->InsertBill(temp.Name,temp.Cost,temp.DueDate); <-this is fine. }



LinkBack URL
About LinkBacks


