Which buffer are you trying to clear? Transmit or Receive?
Generally transmit doesn't need clearing because anything in it usually gets sent out right away. I rarely need to clear the receive buffer. But an easy way to clear it is to just read all the bytes in it and just do nothing with the data.