I believe there's something to do with this code
Code:
#include <stdio.h>#include <stdlib.h>
#pragma warning (disable:4996)
void main()
{
struct Booking {
char bookingID[5];
char bookingTDate[25];
char bookingDate[25];
char bookingTimeStart[4];
char bookingTimeEnd[4];
int bookingUID[10];
char bookingFID[5];
}book;
char answer, answer2;
FILE*bookFile;
bookFile = fopen("booking.dat", "ab");
printf("Do you want to book a facility? (Y=Yes) > ");
scanf("%c", &answer);
if (answer == 'Y' || answer == 'y')
{
do {
printf("Enter booking detail :");
printf("\n\n");
printf("Booking ID : ");
scanf(" %s", &book.bookingID);
printf("Today's Date : ");
scanf(" %d", &book.bookingTDate);
printf("Booking Date : ");
scanf(" %s", &book.bookingDate);
printf("Booking Time : ");
scanf(" %s", &book.bookingTimeStart);
printf("Booking Time : ");
scanf(" %s", &book.bookingTimeEnd);
printf("User ID : ");
scanf(" %d", &book.bookingUID);
printf("Facility ID : ");
scanf(" %s", &book.bookingFID);
fwrite(&book, sizeof(book), 1, bookFile);
printf("Add next booking? (Y = Yes) : ");
rewind(stdin);
scanf("%c", &answer2);
} while (answer2 == 'Y' || answer2 == 'y');
}
else
{
printf("Bye bye \n");
}
fclose(bookFile);
system("pause");
}