Search code examples
cwindowsserial-portcrt

Configure COM port with CRT functions


Is it possible to configure a COM port (bitrate, parity) on Windows using only CRT functions? Or must I use Win32 functions (CreateFile, SetCommState, ReadFile, WriteFile), to use it with the bitrate and parity I want?


Solution

  • If by "CRT" you mean "standard C functions", then I would not expect it to be possible, no.

    Serial ports are not something covered by the C language, so their configuration and management must be system-specific.

    In Linux, it's the termios POSIX API that you use for this, but as clarified in this question it's not available in Windows.