do{
if(flag==1){
printf("Before function called %s\n",buffer);
}
printf("Type in a command or EXIT99 to quit \n");
scanf("%[^\n]",buffer);
flag=1;
}while(strcmp(buffer,"EXIT99")!=0);
I can't work out what is wrong with my code, if i type EXIT99 it quits like it is supposed to, but if I type something else it loops forever and wont let me enter the information again.
if(flag==1){
printf("Before function called %s\n",buffer);
}
printf("Type in a command or EXIT99 to quit \n");
scanf("%[^\n]",buffer);
flag=1;
}while(strcmp(buffer,"EXIT99")!=0);
I can't work out what is wrong with my code, if i type EXIT99 it quits like it is supposed to, but if I type something else it loops forever and wont let me enter the information again.