If you initialize and configure the serial device with tcsetattr() you can flush the serial buffer by setting the new tio with the TCSAFLUSH Parameter:
Code:
tcsetattr(fileDescriptor, TCSAFLUSH, &myNewTTYoptions);
See
POSIX Serial Programming Guide for details.
PS: I made this tardy replay, since this post shows up as result number one while googeling for "flush serial buffer".