Thread: How to delete data...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    6

    Exclamation How to delete data...

    hello everyone, i am in need of serious help.

    i using the turbo C++ 4.5

    plz give me the code in turbo C++, not Visual or any others....

    the problem is how to write a code to delete data inside the *.txt file....
    this work only when user enter the data name then search inside
    the file then delete it.............

    the data in *.txt file with the following entries:

    Country.................................................. .Capital
    Malaysia.......................................... .........Kuala Lumpur
    Japan............................................. ..........Tokyo
    Thailand.......................................... .........Bangkok


    how to delete the "Japan" so that the file will have the following pattern?

    Country.................................................. .Capital
    Malaysia.......................................... .........KualaLumpur
    .................................................. ............Tokyo
    Thailand.......................................... .........Bangkok


    and how to delete the "Japan" and "Tokyo" so that the file will have the following pattern?

    Country.................................................. .Capital
    Malaysia.......................................... .........Kuala Lumpur
    Thailand.......................................... .........Bangkok

    Thanks for helping
    Last edited by alan85; 03-18-2004 at 04:57 AM.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    You'd have to read the file into memory, make the modifications, then write it back. It is possible to write at a certain location in the file, but then you cannot change the size (if writing in the middle of the data).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    6

    Unhappy

    like tht ar...........
    then can't do anything lo.........
    i really need the source code........
    no matter how i must get it..............

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It works like this
    You do it, we help you fix it

    It isn't
    We do it, you go out and party
    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.

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  3. compare and delete data from file
    By moby in forum C Programming
    Replies: 9
    Last Post: 02-07-2005, 03:08 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. C Programming Question
    By TK in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 07-04-2002, 07:11 PM