@@ -119,11 +119,12 rs232port_t rs232open(char* psPortName) | |||
|
119 | 119 | { |
|
120 | 120 | rs232port_t fd; |
|
121 | 121 | /* Char to Wchar conversion*/ |
|
122 | int len = strlen(psPortName),convlen; | |
|
123 |
wchar_t |
|
|
124 | mbstowcs_s(&convlen,wcstr,len, psPortName,len); | |
|
122 | int neededSize = MultiByteToWideChar(CP_ACP, 0, psPortName, -1, 0, 0); | |
|
123 | wchar_t* wcstr = new wchar_t[neededSize]; | |
|
124 | MultiByteToWideChar(CP_ACP, 0, charString, -1, wcstr, neededSize); | |
|
125 | 125 | fd = (rs232port_t)CreateFile(wcstr,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); |
|
126 | #ifdef RS232_debug | |
|
126 | delete wcstr; | |
|
127 | #ifdef RS232_debug | |
|
127 | 128 | if(fd==(rs232port_t)INVALID_HANDLE_VALUE) |
|
128 | 129 | { |
|
129 | 130 | printf("can't open Port\n"); |
General Comments 0
You need to be logged in to leave comments.
Login now