Im doing a program that reads in stuff from the serial port under linux. Once read in there is a bit of formatting and it then needs to get piped to something else. At the end is the cut down code. anyway the interesting part is in the while loop the rest is just formatting. while (1) { // read(fd,buf,50); printf("hello world\n"); } it prints out real fast to screen (as you would expect) and it can be piped to a file ./a.out > test.txt resulting in a large text file (as you would expect) now if the read(fd,buf,50); line is uncommented, it now only does printf("hello world\n") everytime a CR is reciveded on the serial port which terminates the read function (as it should). Now it displays to screen (as it should) but it does NOT pipe to file with ./a.out > test.txt. It creates a blank file but doesnt put anything in it. Why does a read function unrelated to STDIN or STDOUT in the code muck up a linux pipe?????? Got be baffled and dont know what to do now. Is this a GCC thing, a BASH thing or a linux thing Im lost on this one. Can anyone spot the problem (It probably is me but I cant see it) owen (appologies to the gcc@xxxxxxxxxxx where I may have accidently posted this. got a bit confused in the sign up process ie email from gcc-help-help@xxxxxxxxxxx for this list and gcc-help@xxxxxxxxxxx for the other one. I clicked the wrong post to. woops very sorry) ----- #include <fcntl.h> #include <termios.h> #include <stdio.h> #define BAUDRATE B19200 #define MODEMDEVICE "/dev/ttyS0" #define _POSIX_SOURCE 1 /* POSIX compliant source */ main() { int fd; struct termios oldtio,newtio; char buf[50]; fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY ); if (fd <0) {perror(MODEMDEVICE); exit(-1); } tcgetattr(fd,&oldtio); /* save current serial port settings */ bzero(&newtio, sizeof(newtio)); /* clear struct for new port settings */ newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD; newtio.c_iflag = IGNPAR | ICRNL; newtio.c_oflag = 0; newtio.c_lflag = ICANON; tcflush(fd, TCIFLUSH); tcsetattr(fd,TCSANOW,&newtio); while (1) { // read(fd,buf,50); printf("hello world\n"); } tcsetattr(fd,TCSANOW,&oldtio); // restore the old port settings }