I've written an app which reads and write from COM1 and COM2. The input from COM1 is data from a camera telling me the location of a robot and a ball it is chasing. I read in that data from COM1 a few bytes at a time, process it, then send out data on COM2 to tell the robot where to move.

The problem is, when I go back after this cycle to read more data from the camera, the data has been buffered so instead of the most current data it is at least a second old. This is not acceptable when the ball and the robot are both moving in realtime.

If anyone knows how to force a flush of a COM port in vc++ I would be most appreciative.

anthony