This page roughly describes how to get the serial port working in DOS using C code. I have only experimented with sending out signals, but getting the port to receive information shouldn't require much more work (if any). I also used Borland C++ 5.0, but most c compilers seem to have the same libraries.
If you have a better solution or if you find dead links, email me.
Serial port (RS232) basics
9 pin port diagram (what I used, what most computers have)
20 pin port diagram
Windows (32 bit)
Getting things to work in Windows is not hard, as it doesn't appear to care about flow control, and lots of people program for windows now.
Serial Sender - A simple windows program to send commands to any of the serial ports (from Scott Edwards Electronics).
Mini SSC DLL - Scott Edwards Electronics also provides a .dll for use in windows. Some sample c code (32 bit) which uses this dll.
DOS (16 bit)
The most convenient way to do serial communication is by including the Borland header file bios.h and use the command _bios_serialcom or bioscom (less #defines). The only real issue I had with it was that it seems to require some flow control.
However, you can "trick" it by pulling pins 6 and 8 (on a 9 pin connector) high by connecting them to the positive lead on a 9 volt battery. Of course, signal ground (pin 5) should be connected to the negative terminal. Outgoing signals travel on pin3, with pin 5 acting as signal ground (see Basics above if you are now confused). I figured this out using an old external modem, which was a big help since they seem to figure out what flow control is needed automatically (or maybe they just have it built in), and then I disconnected pins one at a time until it stopped working to figure out the vital pins. Kind of a hack, but it worked.
Some sample C code
Why did I do this?
Our lab is using RC servo motors in our biomimetic robot Sprawlita. I wanted to control these RC (radio-controlled) servo motors using a Scott Edwards Electronics Mini SSC II. To move each servo to a new position, it requires 3 bytes of information to be sent via a serial connection (see the manual).