##// END OF EJS Templates
Added char to Wchar conversion.
Jeandet Alexis -
r46:a846d982cee0 qt
parent child
Show More
@@ -7,7 +7,7
7
7
8 #include <windows.h>
8 #include <windows.h>
9 #include "RS232.h"
9 #include "RS232.h"
10
10 #include <locale.h>
11
11
12
12
13
13
@@ -118,7 +118,11 rs232speed_t rs232cfspeed(unsigned int B
118 rs232port_t rs232open(char* psPortName)
118 rs232port_t rs232open(char* psPortName)
119 {
119 {
120 rs232port_t fd;
120 rs232port_t fd;
121 fd = (rs232port_t)CreateFile(psPortName,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
121 /* Char to Wchar conversion*/
122 int len = strlen(psPortName),convlen;
123 wchar_t *wcstr = (wchar_t *)malloc((len*sizeof(wchar_t)) + 10);
124 mbstowcs_s(&convlen,wcstr,len, psPortName,len);
125 fd = (rs232port_t)CreateFile(wcstr,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
122 #ifdef RS232_debug
126 #ifdef RS232_debug
123 if(fd==(rs232port_t)INVALID_HANDLE_VALUE)
127 if(fd==(rs232port_t)INVALID_HANDLE_VALUE)
124 {
128 {
General Comments 0
You need to be logged in to leave comments. Login now