[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Serial programming question



Hi all !
I'm trying to make my first progam, that will read series of bytes from
serial port.
But I have problems opening port. I makeing something like this:

fd=open("/dev/ttyS0", O_RDWR | O_NOCTTY)
if(fd<0)
    {printf("Error opening port\n") ; exit(0)}
printf("Port opend ( %s )\n", ttyname(fd));


And program containing this (run under root) prodused the folloing:

Port opend ( /dev/tty1 )

Or some othe tty, depends on real tty I'm executing this program.

Can anybody tell me what's wrong ? why I've opend /dev/tty1, not
/dev/ttyS0 ?

TIA Alex



Reply to: