For ports COM1 - COM9, you can use the string that this creates:
sprintf(mPortName, "COM%d", curPort);
For ports COM10 and higher, you can use the following string:
sprintf(mPortName, "\\\\.\\COM%d", curPort);
The difference is just putting
"\\\\.\\"
before the name of the port.