Reading the Serial Port

S

sean_in_raleigh

There are various nonstandard packages that allow you to create
C++ streams from stdio streams or file descriptors:

http://wwwcdf.pd.infn.it/MLO/fd.tar.gz
http://www.google.com/search?q=__gnu_cxx::stdio_filebuf
http://www.boost.org/libs/iostreams/doc/classes/file_descriptor.html#file_descriptor

They let you do something along the lines of:

#include "fdstream.hh"

int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
fdostream modem(fd)
modem << "8675309";


For the gory details on how talking to serial ports is different
to regular files, this would be a good start:

http://www.kohala.com/start/apue.html

Sean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top