serial.flush()

permnoob:
I have a serial compass that spews data at a regular rate. GENERALLY my code outruns its refresh rate and its fine, however there are several common times where the buffer may have a chance to build up, and once this happens I will always be several samples behind untill the buffer runs it self over and my code gets mad at me.

One option is to write your code so this doesn't happen...

permnoob:
I was pulling my hair out trying to find such a function, although when you put it that way I can see how having the buffer empty function that I spoke of is less common of a need than I thought.

while(Serial.available())
  int nothing = Serial.read();