View topic - Serial port

Serial port

anything that doesn't fit to other groups.

Serial port

Postby stiefin » Mon Dec 22, 2003 9:47 am

I've never used serial port before, could you plese give me a simple example to start ?
New Member
Posts: 1
Joined: Mon Dec 22, 2003 9:41 am

Postby shilpi » Mon Dec 22, 2003 11:02 am

char *outmsg="Out the serial port";
char inmsg[80];

fd=open("/dev/ser1", O_RDWR);

/* write out the serial port */
write(fd, outmsg, strlen(outmsg);

/* read from the serial port */
read(fd, inmsg, sizeof(inmsg));

New Member
Posts: 9
Joined: Wed Nov 26, 2003 5:33 am

Postby ed1k » Tue Dec 23, 2003 8:39 pm

Look at tcgetattr()/tcsetattr() and other functions of tc* family, if you want some control over serial port (set baud rate, flow control, etc).
QNX Master
Posts: 96
Joined: Tue Jul 23, 2002 10:52 am

Return to General Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest