deleting records from text fle

This is a discussion on deleting records from text fle within the C Programming forums, part of the General Programming Boards category; Hi I have an application which runs 24 hours. It dumps unprocessed data into a flat file( fixed length record). ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    deleting records from text fle

    Hi I have an application which runs 24 hours. It dumps unprocessed data into a flat file( fixed length record). Once the processing on the data is done i want to mark that block in the file as free so that i can re-write on that. in short mark the record as deleted .


    Any suggestion

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Open the file, find its size (GetFileSize() in WIN32), set the file pointer to the begining and read whole file to an dynamicly allocated buffer.

    Delete the file and recreate writting back only what is needed.

    Or simply reset the file pointer to the begining of the processed datas location and overwrite with the next days dump.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Skipping records to text file and storing data.
    By Mr. Deeds in forum C Programming
    Replies: 5
    Last Post: 09-10-2007, 11:24 PM
  2. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 02:17 PM
  3. Removing text between /* */ in a file
    By 0rion in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:54 AM
  4. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21