0

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?

Medinoc
  • 6,577
  • 20
  • 42

1 Answers1

1

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.

Community
  • 1
  • 1
unwind
  • 391,730
  • 64
  • 469
  • 606
  • By "CRT", I mean the one from Visual C++, which contains standard C90 functions + some ersatz of POSIX functions + some Microsoft extensions. – Medinoc May 31 '13 at 12:10
  • I just confirmed that there is no reference to `SetCommState()` whatsoever in the CRT source code, so I'll accept your answer. – Medinoc Jan 22 '15 at 16:08