#include<stdio.h>
#include<conio.h>
#include<Windows.h>
#include <time.h>
#define A 3// name a constant
struct book
{
    char name[20];
    int ID_card;
    int contact_number;
    int dd;
    int mm;
    int yy;
    long int booking_ID ;
}   customer_records[A];
void main()
{
    void Display_reservation();
    void reservation(); 
    void cancelation();//prototype
    int ch= 0;

    do
    {
        system ("cls");
    printf("\n \n \t **Welcome to ballroom reservation system** ");
    Sleep(1000);
    printf("\n \n \n \t \t 1.Reservation \n \n \t \t 2.Cancelation \n \n \t \t 3.Display Reservations \n \n \t \t 4.Exit system \n \n \t \t \t Enter your choice_: ");
    scanf("%d" , &ch);
        // Displaying the main menu
        switch (ch)
        {

        default:
        printf(" \n \n \t  Please enter the right selection");
        Sleep(1500);
        break;
        case 1:
            reservation();    /// calling the function 
            break;
        case 2 :
            cancelation();
            break;
        case 3:
            Display_reservation();
        break;
        case 4 :
            system("cls");
            printf(" \n \n \t \t Exiting the system");
            Sleep(1300);
            return;
        }

    } while (ch != 5);
}

void reservation()
{

    int ctr=0 ;
    char banana;
    static int id = 1000;
    FILE *Reservee;
    system ("cls");
    Reservee = fopen("newrecords.txt", "w+");

    if (Reservee == NULL)   // opening hte file in writing mode
        {
            printf("Error in opening output file %s","newrecords.txt");
        }

    for (ctr=0 ; ctr < A ; )
        {
        do{
            system("cls");
            customer_records[ctr].booking_ID=id;
            printf("\n\n your booking ID is %d" ,customer_records[ctr].booking_ID); fflush(stdin);
            printf(" \n \n \t Enter your name please:");
            scanf("%s",&customer_records[ctr].name); fflush(stdin);
            system ("cls");
            printf("\n \n \t Please enter your ID card number:");
            scanf( "%d" , &customer_records[ctr].ID_card); fflush(stdin);
            system("cls");
            printf("\n \n \t Please enter your Contact number:");
            scanf( "%d" , &customer_records[ctr].contact_number); fflush(stdin);
            system("cls");
            printf ("\n\n Enter Date on which you want to book Ballroom in following format \n  yyyy-mm-dd :");
            scanf ( "%d-%d-%d", &customer_records[ctr].yy ,&customer_records[ctr].mm ,&customer_records[ctr].dd); fflush(stdin);
            fprintf(Reservee,"\n %d\t%s\t%d\t%d\t%d\t%d\t%d\t",customer_records[ctr].booking_ID,customer_records[ctr].name,customer_records[ctr].ID_card,customer_records[ctr].contact_number,customer_records[ctr].yy ,customer_records[ctr].mm ,customer_records[ctr].dd);
            if(customer_records[ctr].yy>= 2017 && customer_records[ctr].yy<= 2018)
            {
            if(customer_records[ctr].mm>=01 && customer_records[ctr].mm<=12)
            {
                //check days
               if((customer_records[ctr].dd>=1 && customer_records[ctr].dd<=31) && (customer_records[ctr].mm==1 || customer_records[ctr].mm==3 || customer_records[ctr].mm==5 || customer_records[ctr].mm==7 || customer_records[ctr].mm==8 || customer_records[ctr].mm==10 || customer_records[ctr].mm==12))
                    printf("\n Date is entered.\n");
                    else 
                        if((customer_records[ctr].dd>=1 && customer_records[ctr].dd<=30) && (customer_records[ctr].mm==4 || customer_records[ctr].mm==6 || customer_records[ctr].mm==9 || customer_records[ctr].mm==11))
                            printf(" \n Date is entered.\n");
                     else 
                        if((customer_records[ctr].dd>=1 && customer_records[ctr].dd<=28) && (customer_records[ctr].mm==2))
                            printf(" \n Date is entered.\n");
                        else 
                            if(customer_records[ctr].dd==29 && customer_records[ctr].mm==2 && (customer_records[ctr].yy%400==0 ||(customer_records[ctr].yy%4==0 && customer_records[ctr].yy%100!=0)))
                                printf(" \n Date is entered.\n"); 
                                else
                            {
                                 printf(" \n Day is invalid.\n");
                                 break;
                            }

                    }
                    else
                    {
                        printf(" \n Month is not valid.\n");
                        break;

                    }
                }
                else
                {
                    printf(" \n Year is not valid.\n");
                    break;

                }
                printf ("\n \n Do you want to continue your booking reservation?");
                scanf("%c", &banana);
            id++;
            ctr++;
        }while(banana == 'y' || banana == 'Y');
        break;
        fclose(Reservee);
    getch();
    }
    system("cls");
printf(" \n \n \t \t \t **taking you back to main menu**");

}

void Display_reservation()

    {

    FILE *Reservee = fopen("newrecords.txt", "r");
    int ctr;
    system("cls");
    if(Reservee==NULL)
    {
        printf("\n \n Error in opening file");
    }
    else
    for (ctr = 0; ctr < A; ctr++)
    {
        fscanf(Reservee,"%d\t%s\t%d\t%d\t%d\t%d\t%d\n",&customer_records[ctr].booking_ID,&customer_records[ctr].name,&customer_records[ctr].ID_card,&customer_records[ctr].contact_number,&customer_records[ctr].yy ,&customer_records[ctr].mm ,&customer_records[ctr].dd); fflush(stdin);
        printf("\n Booking ID:%d\t Name %s\t Cust ID%d\t Contact: %d\t Date:%d-%d-%d\n",customer_records[ctr].booking_ID,customer_records[ctr].name,customer_records[ctr].ID_card,customer_records[ctr].contact_number,customer_records[ctr].yy ,customer_records[ctr].mm ,customer_records[ctr].dd);
        Sleep(1500);
        getch();

    } fclose(Reservee);
}

void cancelation()

{
    FILE *Reservee, *Reservee1;
    int n;
    Reservee = fopen("newecords.txt","r");
    Reservee1 = fopen("modifiedrecords.","w");
    int ctr;
    printf("\nEnter ID of employee to delete ");
    scanf("%d",&n);
    for(ctr=0 ;ctr<A ; ctr++)
    {
        while (!feof(Reservee))
        {
        fscanf(Reservee,"%d\t%s\t%d\t%d\t%d\t%d\t%d\n",&customer_records[ctr].booking_ID,&customer_records[ctr].name,&customer_records[ctr].ID_card,&customer_records[ctr].contact_number,&customer_records[ctr].yy ,&customer_records[ctr].mm ,&customer_records[ctr].dd); fflush(stdin);
        if(customer_records[ctr].booking_ID!=n)
            {
            fprintf(Reservee1,"\n %d\t%s\t%d\t%d\t%d\t%d\t%d\t",customer_records[ctr].booking_ID,customer_records[ctr].name,customer_records[ctr].ID_card,customer_records[ctr].contact_number,customer_records[ctr].yy ,customer_records[ctr].mm ,customer_records[ctr].dd);
            }
        }
    fclose(Reservee);
    fclose(Reservee1);
    remove("newrecords.txt");
    rename("modifiedrecords.txt","newrecords.txt");
    }
}

Looks like maybe a simple typo, you open a file named "modifiedrecords." (without any extension) then try to rename a file named "modifiedrecords.txt" to "newrecords.txt".

commented: Eagle eye. +12

can you please explain a brief

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.