Working with a serial (rs232) port should be an easy thing. Generally you open a serial port as though it were a file, set a few parameters, and you are on your way. This is true on Linux and it’s true on Win32 as well. There’s one gotcha that you need to watch out for. When you open the serial port with CreateFile you must prefix the serial port name with “\.”. The gotcha is that if you open com1 through com4 without that prefix everything will work fine. If you try to open a higher numbered port then you’ll get a “file not found” sort of error. I think the English error text on Windows is “The system could not find the file specified.” You should open every port with the prefix as it is the correct operation. I suspect that com1-com4 works only due to backwards compatibility.
I figured this out thanks to this post.