On C++, conflict between strstream variable and popen() func

Someone knows
why defining a strstream variable and using a popen() a SIGCHLD arrived ?

example:


stream problem(static_buf,2048);


void main(int argc, char **argv)


fd=popen(cmd,“r”);
while (!feof(fp))
{
fscanf(fp, “%s “, stringa);
// printf(”%s”,stringa);
}

during the while () loop a SIGCHLD arrived !!!.
(this is not true if you comment the strstream variable.)

Does someone know why ???

Thank’s in advance.

PRC-ASW <prcswdpt@tin.it> wrote:

Someone knows
why defining a strstream variable and using a popen() a SIGCHLD arrived ?

popen() creates a child process. If that child has died, then it is normal
for a SIGCHLD to get delivered to the parent.

I think the default behaviour for SIGCHLD is for it to be ignored, have
you modified your handling of SIGCHLD? Maybe C++ library for strstream
modifies it? I don’t know the internals of the C++ library well enough.

-David


example:
.
.
stream problem(static_buf,2048);
.
.
void main(int argc, char **argv)
.
.
fd=popen(cmd,“r”);
while (!feof(fp))
{
fscanf(fp, “%s “, stringa);
// printf(”%s”,stringa);
}
.
.

during the while () loop a SIGCHLD arrived !!!.
(this is not true if you comment the strstream variable.)

Does someone know why ???

Thank’s in advance.


QNX Training Services
I do not answer technical questions by email.