diff --git a/src/impl/win.cc b/src/impl/win.cc index 889e06f1..1db2d4bd 100644 --- a/src/impl/win.cc +++ b/src/impl/win.cc @@ -3,6 +3,7 @@ /* Copyright 2012 William Woodall and John Harrison */ #include +#include #include "serial/impl/win.h" @@ -366,7 +367,11 @@ Serial::SerialImpl::setPort (const string &port) string Serial::SerialImpl::getPort () const { - return string(port_.begin(), port_.end()); + string str(port_.length(), 0); + std::transform(port_.begin(), port_.end(), str.begin(), [] (wchar_t c) { + return (char)c; + }); + return str; } void