A com port is like a stream. You open it using open("/dev/ttyS0","r") and get a file 
descriptor. 

Then you use read(fd,buff) to get characters. 
If you want to write to com port, open it with the write flag and use write

The beauty of Unix : devices are treated as files .

Philippe

  


Bret Hughes <[EMAIL PROTECTED]> writes:

> Try the serial programming howto.  Sound like a fit to me.
> I have never actually read it but I always figured if I needed to do
> anything with a serial port that is where I would start.
> 
> Bret
> 
> Jason Hirsch wrote:
> 
> > You might wanna take a look on the web for serial port code-
> >
> > http://www.boondog.com/..\tutorials\dlltutor\dlltutor.htm
> >
> > I found that one.  It's for Vb but i'm sure it'll help....
> >
> > ----------
> > Jason Hirsch, ChemEng/Chemistry
> > Make it myself? But I'm a physical organic chemist!
> > Visit the Dorm Room                  Life may never
> > http://icdweb.cc.purdue.edu/~hirsch  Give us another
> > [EMAIL PROTECTED]       Chance to do right.
> >
> > On Sat, 26 Feb 2000 [EMAIL PROTECTED] wrote:
> >
> > >
> > > Hi,
> > >
> > > I need to write a program or script to read data
> > > from the Com Port and put it into a file, appreciate someone can
> > > guide me or point me to the correct HOW-TO
> > > or link.
> > >
> > >
> > > Thank A Lot
> > >
> > >
> > >
> > > --
> > > To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> > > as the Subject.
> > >
> > >
> >
> > --
> > To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> > as the Subject.
> 
> 
> -- 
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to