Linuxtrent: Re: Porta seriale

  • From: Flavio Stanchina <flavio.stanchina@xxxxxx>
  • To: linuxtrent@xxxxxxxxxxxxxxxxx
  • Date: Tue, 27 Feb 2001 00:34:47 +0100

Hello Daniele,

> Nel frattempo un esempietto:

> #include <unistd.h>
> #include <fcntl.h>
> #include <termios.h>

> int s_init(char * device)
> {
>        int fd;
>        struct termios * newtio;

>        fd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK);
>        newtio->c_cflag = (B9600 | CRTSCTS | CS8 | CLOCAL | CREAD);
>        newtio->c_iflag = (IGNPAR | ICRNL);
>        ...

Magari si potrebbe anche allocare un po' di spazio per newtio, tanto per
non ballare una rumba su qualche pezzo di memoria innocente... ;)

-- 
Ciao,
        Flavio <flavio.stanchina@xxxxxx>
        http://users.iol.it/flavio.stanchina/
--
The only thing that stops God from sending another flood is that
the first one was useless.
-- Chamfort


-- 
Per iscriversi  (o disiscriversi), basta spedire un  messaggio con SOGGETTO
"subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxxxxxx


Other related posts: