Re: coprocess question
- From: jasen <jasen@xxxxxxxxxxx>
- Date: 22 Dec 2006 06:54:45 GMT
On 2006-12-21, Ronald <followait@xxxxxxx> wrote:
The program below is from APUE.
It is about coprocess.
Mainly, the parent deliver input to ``add2" through pipe A, and the
result is deliver back from ``add2" through pipe B.
The question is about stability, please search ``**" for it.
//** Here is the question:
//Is it possible that the result is
//more than one digit, but only
//one digit is read from the pipe?
//For example:
//input is ``11 22\nC-d"
//will the output be "3"?
in general yes, in this artificial case the result is most unlikely to be split.
static void sig_pipe(int signo)
{
printf("SIGPIPE caught\n");
exit(1);
}
that is most naughty. you shouldn't call printf from a signal, handler,
almost guaranteed to cause erattic, hard to find, problems.
Bye.
Jasen
.
- References:
- coprocess question
- From: Ronald
- coprocess question
- Prev by Date: crontab
- Next by Date: Re: does anybody know an very old technology called BBS and how to program BBS?
- Previous by thread: Re: coprocess question
- Next by thread: crontab
- Index(es):
Relevant Pages
|