> 
> As a side problem:
> 
> This code doesn't print anything until a \n is received from the
> sending unit:
> 
> ...
> char buf[255];
> ...
>     while (STOP==FALSE) {       /* loop for input */
>         res = read(fd,buf,1);   /* returns after 1 chars have been
> input */
>         printf("%c", buf);
>         if (buf[0]=='z') STOP=TRUE;
>     }
> 
> But this code does:
> 
> ...
> char buf[255];
> ...
>     while (STOP==FALSE) {       /* loop for input */
>         res = read(fd,buf,1);   /* returns after 1 chars have been
> input */
>         printf("%c\n", buf);
>         if (buf[0]=='z') STOP=TRUE;
>     }
> 
> Why would the addition of a \n fix the code. It appears to flush the
> print buffer.
> 

Well, I thought you were using Perl, but I guess not :)  Anyway, you're
right.  In my experience, printf won't print until it sees a \n or \r or
some other character that will flush the buffer.  I'm no C guru though.

Gabe
-- 
--------------------------------------------------------------------------------
Gabe Turner				       |  	   X-President,
UNIX Systems Administrator,		       | Assoc. for Computing Machinery
U of M Supercomputing Institute for	       |    University of Minnesohta
Digital Simulation and Advanced Computation    |       dopp at acm.cs.umn.edu

"Did I ever tell you about the Tooth Beaver, Ren?  Wherever you have nerve
 endings, you'll find the Tooth Beaver! ... The nerve endings are the
 tastiest part of your body, and your Tooth Beaver knows this."
					- Stimpson J. Cat in "Ren's Toothache"
--------------------------------------------------------------------------------