From c9a2a086cab64b567f4fc14ad0e61a020f2d841e Mon Sep 17 00:00:00 2001 From: Ben Moyer Date: Fri, 19 May 2017 16:57:59 -0700 Subject: [PATCH] implement flushInput and flushOutput for windows --- src/impl/win.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/impl/win.cc b/src/impl/win.cc index 3446160..87eef13 100644 --- a/src/impl/win.cc +++ b/src/impl/win.cc @@ -471,13 +471,19 @@ Serial::SerialImpl::flush () void Serial::SerialImpl::flushInput () { - THROW (IOException, "flushInput is not supported on Windows."); + if (is_open_ == false) { + throw PortNotOpenedException("Serial::flushInput"); + } + PurgeComm(fd_, PURGE_RXCLEAR); } void Serial::SerialImpl::flushOutput () { - THROW (IOException, "flushOutput is not supported on Windows."); + if (is_open_ == false) { + throw PortNotOpenedException("Serial::flushOutput"); + } + PurgeComm(fd_, PURGE_TXCLEAR); } void