C Code to Talk to Arduino (Windows Operating System)

Hello!

I am trying to figure out how I would, on a Windows operating system, write a code in C that can send commands to and then read data from an arduino. The only thing that I found that tries to tackle this problem is this site:

http://todbot.com/blog/2013/04/29/arduino-serial-updated/

I am very new to programming, so I don't know if I just don't understand what this person is saying about communicating with an arduino in C on a Windows system, of if there just isn't a good (or working) example of how to do this. I went to the code that they posted on Github here:

However, it seems that only examples of how this is done on Linux and Mac are posted. When I just tried to play around with one of the example codes (I also downloaded and included "arduino-serial-lib.h" in my program), I got a bunch of errors that, upon Googling, seem to be due to the fact that the posted code is for Linux and Mac.

If anyone has any ideas as to how I can do this, or if you actually understand what the site above is saying for a Windows system, any help would be appreciated.

Thank you!!

write a code in C

Why? C is just about the hardest language to use to write to/read from the serial port. C# makes it trivial.

Unfortunately, I am in a C programming class, so I have to use C. Just to clarify for those who may worry that this may be me just asking for the answers to my homework, I was not assigned what I asked about-- it is just part of what I need functioning for the project that I came up with, where I am trying to collect data from a sensor on an arduino, but my user interface, etc. is all done through the C program.

Have a look at this site: Serial Port Programming on Windows using Win32 API | xanthium enterprises
It shows how to open and read/write a COM port. In particular, the example of opening a COM port shows the correct syntax for opening a COM port number greater than 9.

Pete

Thank you, el_supremo!!! That was exactly what I need, plus it explains everything!! I finally got everything working (AND I unserstand the code).