Quote:
Originally Posted by xhi
it only seems to lock up when it is written to while it is disabled. is this you intention to write while it is off?
|
thanks you help.
I just want to see what will happen while is off. Now I see WRITE will suspend process while transmission is disabled. This situation makes terminal unable working.
And there is another question about the code below:
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
int main(void)
{
int fd;
fd = fileno(stdout);
write (fd,"Example of line control functions \n",34);
tcdrain (fd);
fprintf (stdout, "this line is delayed "); /* ??? */
tcflow(fd, TCOOFF);
tcflush(fd, TCIOFLUSH);
tcflow (fd, TCOON);
write(fd,"restart the output\n",20);
}
I run the program in LINUX and get result as below:
$a.out
Example of line control functions restart the output
this line is delayed $
It seems that the line outputed by fprintf should be
flushed by tcflush(), but it is not. why?
Maybe I am not well understand the mean of tcflush or the way of terminal i/o.