If you intend to write a GPL-licensed, opensource and multiplatform program in C or C++ and you want to use the serial port, look here:

RS-232 for Linux and Windows

With this library, you can use GCC on Linux and MinGW on windows to access the serial
port without the need to make any changes in your sourcecode.

The reason for this repost is an update of the library:

- added the prefix "RS232_" to all functions in order to prevent clashes with other libraries
- set the DTR pin and RTS pin active when opening a serial port (some RS-422/485 converters need this to enable the outputbuffers)
- added the baudrates 500000 and 1000000 for windows, this can be usefull when using an FTDI-chip or USB-converter
- added the devices "/dev/ttyAMA0" and "/dev/ttyAMA1" for use with the Raspberry Pi
- added the devices "/dev/ttyACM0" and "/dev/ttyACM1" for use with the Atmel (USB-)microcontrollers
- added the devices "/dev/rfcomm0" and "/dev/rfcomm1" for use with Bluetooth
- added the devices "/dev/ircomm0" and "/dev/ircomm1" for Infrared communication
- added the following functions: RS232_enableDTR(), RS232_disableDTR(), RS232_enableRTS(), RS232_disableRTS() and RS232_IsDSREnabled()
- changed function "cprintf()" to "RS232_cputs()"