Program Terminating With Error On Exit
Hi,
I have a program which when i select the quit option it terminates borland 3.1 with errors or just terminates.
Below is a snippet of my code. I cannot see anythin which should be causing an error, however i am still fairly new to C.
Code:
case 'J':
/* Save Database */
if(saveDatabaseFile(ptrDatabase, fname, &counter, &lastRecordID, &changesMade) == 1){
printf("\n\n Database Saved!\n\n Press Any Key To Continue >");
getch();
clrscr();
}
break;
case 'Q':
/* Exit */
if(changesMade == 1){
printf("\n Changes Have Been Made To The Database...\n\n Would You Like To Save These Changes? (Y/N/C) >");
do{
choice = toupper(getchar());
}while((choice != 'N') && (choice != 'Y') && (choice != 'C'));
if(choice == 'Y'){
saveDatabaseFile(ptrDatabase, fname, &counter, &lastRecordID, &changesMade);
return 1;
}else if(choice == 'N'){
return 1;
}
else if(choice == 'C'){
clrscr();
break;
}
}
else {
return 1;
}
break;
default:
printf("\n Error: Selection was not reconised...Please select again\n\n");
break;
If anyone could shed some light on this problem it would be great. The program works fine untill the quit option is selected which would surgest that its only a problem with that section of code, however i do not know.
Incedently it does run the saveDatabaseFile(...) function so i know it gets this far.
main has a return type of int.
Cheers in advance
Chris