> IMHO - keep using the open/read/write functions. They do give you > better control with less buffering. (but very slightly less portable) Hmm, ok. Just in case this is my port opening routine (it's hardcoded for the moment, I actually got this code from a website): int open_port(void) { int fd; /* File descriptor for the port */ fd = open("/dev/ttyS1", O_RDONLY | O_NOCTTY | O_NDELAY); if (fd == -1) { /* * Could not open the port. */ perror("open_port: Unable to open /dev/ttyS1 - "); } else fcntl(fd, F_SETFL, 0); return (fd); } > Are you "reading" something, but the read function is returning an error > because there is nothing to read?? Check the return value of read(). > It should be the number of bytes gotten. I do check the return value and have the program set to error out if the value returned is either 0 or -1: returned_bytes = read (fd, &char_buf, 1); if (returned_bytes == 0 || returned_bytes == -1) { printf ("Error: Read of port failed! Aborting...\n"); exit (1); } > If the file descriptor is set > up for non-blocking reads and there is nothing there it will return a -1 > with errno set to EAGAIN. Of course once you get misplaced in where the > software thinks it is in the stream of data things get real hairy real > quick. > > Dan According to the docs I have the fcntl up above sets it for blocking (which is what I want, I want the program to sleep until something is received. Thanks for the help. TTYL ---------------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads