How to write/read from the RS232C serial port?

Hi!

I have to write an application which sends/receives a data through the RS232C port but don't really know where to start.
The standard input stream comes from the keyboard and output goes to the screen. How could I change this?

Please help!
Serial port access is OS-dependent. What OS are you using? Dos? Linux? Windows?
Actually at this moment Vista and Ubuntu Gutsy 7.10.
On Linux just redirect stdin and stdout from/to a serial port.

cat - < /dev/ttyS1

would redirect COM1 into cat.

Otherwise you can close stdin and reopen file descriptor 0 as /dev/ttyS1, etc.
Thanks! I'll try that. Would you also have any suggestions for Vista?
Nope, sorry, I don't program in Windows. Maybe someone else can field that one.
It's been a long while since I've done it on Windows, but it is straight forward.
This link should get you going...
http://www.robbayer.com/files/serial-win.pdf
Topic archived. No new replies allowed.