Why are you doing the tcgetattr/tcsetattr twice?

That's my bad, just take the first one out. Can't cut and paste properly.


It should be port_opt.c_cflag = CLOCAL|CREAD; You seem to be setting the c_oflag with those bits. The corresponding bits in the oflag mask would be OFDEL|TAB1
I typically set c_iflag = c_oflag = c_lflag = 0; and c_cflag = (CSIZE&CS8)|CLOCAL|CREAD;

Is there anywhere these are defined? (For documentation, I mean.) The c_?flag things I just got looking at another piece of code, and figured that I didn't have to set it to 8N1, since it defaults to that anyways..


The three digit hex encoding always irks me, it is normal for octal numbers, but in this case does \x010 translate to the array 0, 16 or simply 16? I couldn't find a clear answer in my C reference book.

As far as I could tell (and it works this way when I'm sending it data..) "\x016" is just 0x16, and "\x13F" would be 0x13F..


As far as the read being from stdin, I don't know really what could be causing it. Maybe one of the things I mentioned magically fixes it. You can also check the declared types and order of your variables. If vfd_fd is not an int, or the variable declared right before vfd_fd is a char buffer, you might have a simple overflow problem, clobbering the variable with null bytes.

I'll try what you have above, as well as what was in the other response. It just threw me because all my write()'s were functioning normally..

Thanks!
Mike.
_________________________
Mike 'Fox' Morrey 128BPM@124MPH. Love it! 2002 BRG Mini Cooper