flushing stdin

This is a discussion on flushing stdin within the Linux Programming forums, part of the Platform Specific Boards category; In the faq, there is a section saying that it is unsafe to fflush(stdin) (it doesn't work correctly anyway). I'm ...

flushing stdin

In the faq, there is a section saying that it is unsafe to fflush(stdin) (it doesn't work correctly anyway). I'm having a problem with a function and an infinate loop with switch statement where the stream has not been cleared and outputs unwanted printf data instead of pausing to read scanf. Here's a snippet:
This is the call to the function in question from main:

Here's a trial run:
1: Print a list of the rooms:
2: Retrieve an occupier:
3: Free a room
4: Add a guest:
5: Find a free room
Enter a number 1 - 5: 4
Check occupant into what room? 1 - 10: 1
Enter last name. Do not exceed 19 chars: There was an error in your input, try again:
There was an error in your input, try again:
There was an error in your input, try again:
There was an error in your input, try again:
Enter first name. Do not exceed 17 chars: There was an error in your input, try again:
There was an error in your input, try again:
There was an error in your input, try again:
There was an error in your input, try again:
The guest was added
1: Print a list of the rooms:
2: Retrieve an occupier:
3: Free a room
4: Add a guest:
5: Find a free room
Enter a number 1 - 5:
----------------------------
Maybe writing the data to /dev/null would help? How would I do that if that would be a solution?