I am using winapi to create a serial connexion with an arduino, I used:
HANDLE hSerial = CreateFileA("COM3", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
To open serial port and it returns a valid handle but when i put this snippet on a class method like this:
SerialConnexion::open() {
HANDLE hSerial = CreateFileA("COM3", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
}
It returns a **ERROR_ACCESS_DENIED
**why is this happening? I think that is due
LPSECURITY_ATTRIBUTES
attribute but I am not sure, I would appreciate it if someone could guide me.