Clear input data from serial port in boost::asio

前端 未结 1 2031
迷失自我
迷失自我 2021-01-14 09:11

I\'m writing a C++ program for communicating with a Arduino over a serial port using boost::asio. After establishing the connection the Arduino resets itself. However the in

相关标签:
1条回答
  • 2021-01-14 09:26

    You can flush the serial buffer, which should do what you want (get rid of all pending data up to the time of the flush). Unfortunately, it seems Boost does not have a wrapper for doing this, so you have to grab the native_handle for the serial port. I based the code I'm using off this answer: https://stackoverflow.com/a/22598329/1167230

    0 讨论(0)
提交回复
热议问题