[ad_1]
I have the following function that I am using to initialize a HANDLE to a serial port
int initSerialPort(HANDLE* hSerialPort, string portName){
*hSerialPort = CreateFile(
_T(portName),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0
);
return 0;
}
I want to be able to hand this function a string as a parameter. When I use
_T("COM1"),
as the parameter it works, however, when I try to hand a string in I get an error “Lportname is undefined”.
How can I easily do this, and why am I getting this error?
[ad_2]