imabot2 / serialib

Serial library for Linux & Windows
MIT License
195 stars 45 forks source link

cannot close serail port #29

Open SJavad opened 1 year ago

SJavad commented 1 year ago

i run this code:

int main()
{
    serialib serial;

    if (serial.openDevice("\\\\.\\COM10", 115200)!=1){

        cout << "COM Port Does not opened";
        return 1;

    }

    for (int c = 32; c < 128; c++)
    {
        cout << "CHAR: " << c ;
        serial.writeChar(c);
        Sleep(100);
    }

    serial.closeDevice();
    cout << "Send Complete...";
    return 0;

}

and when i want to close my port I get exception: Screenshot 2023-09-12 201622