Like Tree1Likes
  • 1 Post By Salem

Doesn't editing and deleting data from file!

This is a discussion on Doesn't editing and deleting data from file! within the C Programming forums, part of the General Programming Boards category; hi, i have made bank system program. The problem is that it is not deleting and editing the data. Also ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    4

    Doesn't editing and deleting data from file!

    hi,


    i have made bank system program.

    The problem is that it is not deleting and editing the data.
    Also it is not editing the current balance.

    Can some one do that for me.

    I have attached .CPP file because it has long coding.
    Code:
    http://www.mediafire.com/?pc9fxj8ew3pskz3

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,294
    Quote Originally Posted by saddists View Post
    Can some one do that for me.
    No, we do not do your work for you.
    Read the homework policy, and if you cant understand it then go away and do not use this website.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,447
    > I have attached .CPP file because it has long coding.
    Step 1 is rename your source file to be say AzharProject.c
    I figure you're trying to learn C, but what you posted will only compile with a C++ compiler.

    2. Read -> SourceForge.net: cpwiki
    fflush(stdin) and gets(foo) are BAD CODE.

    3.
    Code:
         if (fdata== NULL)
    
         {
    
         puts("Unable to open the file");
    
         main();
    
         }
    You have an awful lot of recursive calls to main for absolutely no good reason. Just return, like this
    Code:
         if (fdata== NULL)
    
         {
    
         puts("Unable to open the file");
    
         return;
    
         }
    and put a "while" loop around all the code in main you want to repeat over and over until the user exits.

    4. while( fread( &searchaccount, sizeof(*searchaccount), 1, fdata) )
    Except searchaccount isn't the same size as your struct, so this will screw up badly.
    rac1 likes this.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. editing data in a data file
    By sujeet1 in forum C++ Programming
    Replies: 5
    Last Post: 06-12-2007, 09:13 PM
  2. Replies: 9
    Last Post: 11-09-2006, 06:31 PM
  3. Dev-Cpp doesn't understand the data type FILE
    By KidMan in forum C Programming
    Replies: 3
    Last Post: 12-31-2005, 07:59 PM
  4. Editing a data file
    By Strait in forum C++ Programming
    Replies: 7
    Last Post: 02-05-2005, 03:21 PM
  5. Inserting/Deleting Data Within Large File :: Win32
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 11-22-2003, 10:24 AM

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