cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
How to write/read from the RS232C serial
How to write/read from the RS232C serial port?
Oct 29, 2008 at 10:31pm UTC
n0ext
(3)
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!
Oct 30, 2008 at 4:09am UTC
jsmith
(5804)
Serial port access is OS-dependent. What OS are you using? Dos? Linux? Windows?
Nov 1, 2008 at 2:31pm UTC
n0ext
(3)
Actually at this moment Vista and Ubuntu Gutsy 7.10.
Nov 1, 2008 at 4:17pm UTC
jsmith
(5804)
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.
Nov 4, 2008 at 8:54pm UTC
n0ext
(3)
Thanks! I'll try that. Would you also have any suggestions for Vista?
Nov 4, 2008 at 9:53pm UTC
jsmith
(5804)
Nope, sorry, I don't program in Windows. Maybe someone else can field that one.
Nov 4, 2008 at 10:27pm UTC
guestgulkan
(2942)
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.