Echo serial port to console in C (windows)

I am completely new to programming in C and am trying to access and read serial ports. I am trying to listen to COM1. What I am trying to do is to sit in a while loop and have the serial messages echoed to the console. Any help would be greatly appreciated. I am very new to C and do not understand very much of it. I am using the gcc compiler on a Windows XP machine.

Any help and/or code would be greatly appreciated

Thank you!
Who is Participating?
Take a look at ("Serial Communications in Win32") - this article contains everything you need to know and also comes with full source code.
beavis601Author Commented:
To clarify, I want to be able to open a serial port and listen for incoming streams.

wait for messages to come in and send them to my own buffer to be echoed to the console
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.