Problem editing a record

This is a discussion on Problem editing a record within the C Programming forums, part of the General Programming Boards category; Can someone PLEASE help me, i've got the structures and all declared but i've still go a problem with this ...

  1. #1
    robbielove
    Guest

    Unhappy Problem editing a record

    Can someone PLEASE help me, i've got the structures and all declared but i've still go a problem with this code. It runs but wont edit the data...


    void AmendRecord(MEMBER Members[MAXMEMBERS])
    {
    char Memb_NoToAmend[20], Answer;
    int Found=0, CurrentMember=0;

    clrscr();

    printf("Enter Number of Member to be Amended : ");gets(Memb_NoToAmend);

    while( (CurrentMember < TotalRecords) && !Found)
    {
    if(strcmp(Members[CurrentMember].Memb_No,Memb_NoToAmend)==0)
    {
    Found=1;

    printf("\nMember Details:\n");
    printf("\t\tMember No: %s",Members[CurrentMember].Memb_No);
    printf("\n\t\tMember Name: %s",Members[CurrentMember].Memb_Name);
    printf("\n\t\tMember Street: %s",Members[CurrentMember].Memb_Street);
    printf("\n\t\tMember Town: %s",Members[CurrentMember].Memb_Town);
    printf("\n\t\tMember County: %s",Members[CurrentMember].Memb_County);
    printf("\n\t\tMember Contact No. : %s",Members[CurrentMember].Memb_ContactNo);

    printf("\n\nAre you sure you wish to Amend this Member [Y/N] : ");Answer=getchar();

    if(Answer=='Y' || Answer=='y')
    { /* Read new details into array */
    printf("\nEnter Member Details:\n");
    fflush(stdin);
    printf("\t\tMember No: ");
    gets(Members[TotalRecords].Memb_No);
    printf("\n\t\tMember Name: ");
    gets(Members[TotalRecords].Memb_Name);
    printf("\n\t\tMember Street: ");
    gets(Members[TotalRecords].Memb_Street);
    printf("\n\t\tMember Town: ");
    gets(Members[TotalRecords].Memb_Town);
    printf("\n\t\tMember County: ");
    gets(Members[TotalRecords].Memb_County);
    printf("\n\t\tMember Contact No. : ");
    scanf("%s",Members[TotalRecords].Memb_ContactNo);
    fflush(stdin);
    }
    else
    printf("Record not amended...");
    }
    else
    CurrentMember++;
    }

    if(!Found) /* If the Record was not found */
    printf("RECORD not found in FILE...");
    getch();
    }

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Read this and this and this.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. First record returning null??
    By Kumura in forum C Programming
    Replies: 7
    Last Post: 05-31-2005, 07:10 PM
  2. can't save 13th record in files
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 07-15-2002, 10:08 PM
  3. display problem after retrieving from text
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 01-29-2002, 05:48 AM
  4. Replies: 1
    Last Post: 09-30-2001, 07:45 AM
  5. Modifying A Record In C++...help Needed
    By Conquerer in forum C++ Programming
    Replies: 2
    Last Post: 09-28-2001, 09:34 PM

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