CreateFile() Serial Communication Issue [duplicate]
问题 This question already has an answer here : How to open COMXX files(serial port) (1 answer) Closed 5 years ago . I am trying to do some serial communication through my usb port (named COM15), and I am getting an error. This is the code where the error is occurring: HANDLE myPortHandle = CreateFile("COM15", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (myPortHandle == INVALID_HANDLE_VALUE) { DWORD lastError = GetLastError(); cout<<"ERROR HERE! = "<<lastError<<endl; } Every