diff --git a/src/RS232_win.c b/src/RS232_win.c --- a/src/RS232_win.c +++ b/src/RS232_win.c @@ -7,7 +7,7 @@ #include #include "RS232.h" - +#include @@ -118,7 +118,11 @@ rs232speed_t rs232cfspeed(unsigned int B rs232port_t rs232open(char* psPortName) { rs232port_t fd; - fd = (rs232port_t)CreateFile(psPortName,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); + /* Char to Wchar conversion*/ + int len = strlen(psPortName),convlen; + wchar_t *wcstr = (wchar_t *)malloc((len*sizeof(wchar_t)) + 10); + mbstowcs_s(&convlen,wcstr,len, psPortName,len); + fd = (rs232port_t)CreateFile(wcstr,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); #ifdef RS232_debug if(fd==(rs232port_t)INVALID_HANDLE_VALUE) {