How do i 'flush' the serial port???

Hi all. I’m trying to write a program that will store three characters from the serial port, and store them in szBuffer.

All is well, but i have a small problem i don’t know how to fix

Well there are a total number of input characters that aren’t a integer multple of 3, then i will have remaining characters lingering in my buffer.

How do i get rid of these values, as they screw up programs inputs the next time the program is run.

iBytesRead = readcond(iFileDescriptor, szBufferI,3,3,0,0);
szBufferI[iBytesRead] = ‘\0’;

Try tcflush … flush.html