Another Noobie,
Hi everyone. Im Barry, i just started using C over the last 4 months as part of my college course. I have a basic understanding of the language.
I have problems with some of the error trapping in my programming assignment and i was hoping you might be able to point me in the right direction.
Firstly:
I have the program compiling fine and looping when any number other than 1 or 2 are entered but when i enter a character it goes into an infinite loop.Code:void menu1(void) { void FileName (void) ; int iChoice; puts("\t\t\t\tMENU\n"); puts("\t\t\t1.\tEnter File Name"); puts("\t\t\t2.\tExit"); printf("Enter your choice: "); scanf_s("%d", &iChoice); switch (iChoice) { case 1: FileName(); case 2: exit(0); default: puts("Please select either 1 or 2"); menu1(); } /*end switch*/ } /*end menu1*/
This is probably pretty simple to fix but like i said im a noobie. Id appreciate any help you can give me!!
Thanks
Barry