How are strings in general represented in your program?
char
wchar_t
TCHAR
Is it being compiled with _UNICODE defined?
Assuming char say, then
Code:
int main ( int argc, char *argv[] ) {
char portname[100] = "\\\\.\\";
if ( argc >= 2 ) {
// command line arg is just say COM10
strcat(portname,argv[1]);
}
hSerial = CreateFile(
portname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
}
If your program begins with WinMain() and not main(), then start with GetCommandLine.