Hey all. First time user here :)

Im making a Windows XP C++ console application with Code Blocks (GNU GCC Compiler). This program is written to control another program that is missing some features i need (read input from external source). Last thing im missing from my program is little serial port handling. I made a loopback plug to serial port with few on/off switches and its working great. I have tried to look for a code to read the CTS (clear to send) / DSR (data set ready) states from serial port but no avail.

I know winapi has some (Serial Communications in Win32) solutions to these (Communications Event Flags? WaitCommEvent function?) but i cant really understand winapi because im just getting to know C++. Im assuming i need to initialize the serial port first (to get things going) with CreateFile function and after that i could read the event flags from the loopback plug.

Is there a better way to init serial port and read status of dsr/cts signals from loopback plug than winapi event flags? Anyone feeling to share some piece of code to init and check these statuses of serial port? Any help would be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.