lundi 6 mars 2023

E0167 argument of type "const char *" is incompatible with parameter of type "LPCWSTR"

#include <Windows.h>
#include <iostream>
#include <vector>
#include <string>
std::vector<std::string> serialCOM::list_serial_ports()
{
    std::vector<std::string> ports;
    // Enumerate all available COM ports
    for (int i = 1; i <= 256; i++) {
        std::string port = "COM" + std::to_string(i);
        HANDLE hComm = CreateFile(port.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

    }
    return ports;
    
}

Expecting No Error for this line // CreateFile(port.c_str() E0167 argument of type "const char *" is incompatible with parameter of type "LPCWSTR"

Aucun commentaire:

Enregistrer un commentaire