It's a lot easier just to use fgets() for ALL input, then use sscanf() to get what you need.
By the time you've added full error(*) checking to the code, starting with fgets() offers a fairly simple solution. Patching up scanf() when it's going wrong is messy.
Eg.
Code:
char buff[BUFSIZ];
if ( fgets( buff, BUFSIZ, stdin ) != NULL ) {
if ( sscanf( buff, "%d %d %d",
&IBcourse.commencingdate.month,
&IBcourse.commencingdate.day,
&IBcourse.commencingdate.year) == 3 ) {
// now check for valid dates, such as not allowing Feb 29 on non-leap years
} else {
// not 3 integers
// the side-effect of using fgets() with a large buffer is that it will already have
// read up to the newline, so there isn't a need to "flush" the input stream.
}
} else {
// EOF or some other I/O error
}
You see, making it bomb-proof takes quite a lot of effort.
(*)For extra security, you shouldn't use sscanf() at all.
None of the numeric conversions (%d,%f etc) detect overflow or underflow.
The string conversions %s and %[ are tricky to use correctly when trying to extract a small string from a large buffer.
%c is just plain pointless, you may as well just use an array index directly into the buffer.