Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Serial usage example

0 views
Skip to first unread message

Mark Lebowski

unread,
Sep 30, 2000, 3:00:00 AM9/30/00
to
Has anybody a little source example for open-read-write-close serial port
device under linux ?
Thnx

Mazzachre

unread,
Oct 1, 2000, 3:00:00 AM10/1/00
to

Read the io programming howto on LDP (If you want POSIX interphase, go
for the linked doc, in the serial chapter it is quite good)

But very simply put:

you open the serial device:

FILE *fd;

fopen(fd, "/dev/ttyS0", wr) (Or something like that)

you write to the device:

write(fd,"hello world",11)

you read from the device:

read(fd, &input)
(If there is no data in the input buffer, your program will freze
until some input comes...)

and you close the device

fclose(fd)

- Mazzachre

Ajay or Purnima Koliwad

unread,
Nov 5, 2000, 3:00:00 AM11/5/00
to
Hi!
The answer to your question is as simple as the hyperlink below.

http://www.linuxdoc.org/HOWTO/Serial-Programming-HOWTO.html

Enjoy.
Ajay

Mark Lebowski wrote:

> Has anybody a little source example for open-read-write-close serial port
> device under linux ?

> Thnx


0 new messages