Thread: Delete function for C database

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    1

    Delete function for C database

    Ok, bit of background. I'm in foundation year of CRTS and I have a major project due in after easter.

    Problem is, i can't seem to figure out how to make a delete function for the database taht i've written.

    My lecturer seems to think that i should just add a tag to any that are deleted and then get the display functions to ignore anythin' with the tag. Now, in my mind thats pretty damn wasteful cos if the program is being used for a few years you could end up with an external file that is HUGE but hasn't actually got much of value in it.

    One idea was to copy everything (except what i want to delete) from the orginal struct to a spare array, and then copy it all back again. Would this work?

    Can anyone point me in the write direction please?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > Can anyone point me in the write direction please?
    Both would work, but both have advantages and disadvantages.
    Try them both and learn something about such tradeoffs for your future programming tasks.

    > My lecturer seems to think that i should just add a tag to any that are deleted
    For example, when you add a record, the first thing you do it look for a deleted record you can re-use.
    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. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  3. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM