Thread: C++ adr book challenge - array with contact info written to disk and read back in

  1. #1
    Registered User
    Join Date
    Dec 2011

    C++ adr book challenge - array with contact info written to disk and read back in


    I have to resolve a problem where an address book is saved to disk and read back in.

    I would appreciate some help with the logical flow.

    This program allows user to add personal info and read it back in, and then add additional records.

    -- There are 2 classes- one for Personal info, one for a List array.
    -- A menu allows user to add / show all personal record info.
    -- on Quit, program writes list array to disk.
    -- on Launch, program reads it back in.

    I tried different approaches with respect to reading the inFile into memory and adding new records. Dependend on what I do get different results - but - none lead to satisfaction.

    For example, added record overwrites 1st record in memory, or non is added but the first record in the array is duplicated at the end of the list - with out having the New Record added in and so forth.

    Do you have any structural suggestions for order as to when things need to happen? Or, do you have any code I can use /look at for this? I am sure it has been done many times but what I found on the web are only pieces for i/o streams but I could not get beyond that or utilize it correctly.

    I truly would appreciate your help! Btw, in my class we didn't have pointers/vectors/templates/friends yet. Solutions need to be accomplished without those fancy approaches if possible.

    Thanks so much!

    Last edited by der25; 12-10-2011 at 11:01 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    I would suggest you post the code for one of your better attempts, and then describe what is wrong with it, then we can correct your actual mistakes (code or comprehension).

    Copy/paste code might give you some ideas, but it's no substitute for actual learning (by doing it yourself).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to delete a contact in a phone book?
    By blogchama in forum C Programming
    Replies: 10
    Last Post: 01-25-2010, 12:37 PM
  2. Data read off disk problem
    By Sly in forum C Programming
    Replies: 9
    Last Post: 01-13-2009, 04:33 PM
  3. Direct Disk Read/Write
    By abachler in forum Networking/Device Communication
    Replies: 3
    Last Post: 10-06-2008, 09:20 PM
  4. read write from hard disk
    By bojan in forum C Programming
    Replies: 3
    Last Post: 05-17-2006, 01:15 AM
  5. Brackeen has written a book now
    By DavidP in forum Game Programming
    Replies: 0
    Last Post: 03-25-2004, 01:10 AM