Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using CreateFile WIndows API to open a COM port .
but it never open port greater than 9 . How can i fix this thing so that it will be able to open port higher than 9.
Posted

1 solution

For ports COM1 - COM9, you can use the string that this creates:

C++
sprintf(mPortName, "COM%d", curPort);


For ports COM10 and higher, you can use the following string:

C++
sprintf(mPortName, "\\\\.\\COM%d", curPort);


The difference is just putting "\\\\.\\" before the name of the port.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900