I cannot get printf to work from a spawned process. The process is created
OK and the code for it is very simple (see below)
#include<stdio.h>
int main()
{
printf(“This is the spawned process\n”);
return 0;
}
The terminal displays printf messages from the parent process but not from
the child. What am I doing wrong?
–
Paul.
Paul Jones <paul.jones@bnc.ox.ac.uk> wrote:
I cannot get printf to work from a spawned process. The process is created
OK and the code for it is very simple (see below)
#include<stdio.h
int main()
{
printf(“This is the spawned process\n”);
return 0;
}
The terminal displays printf messages from the parent process but not from
the child. What am I doing wrong?
Perhaps something in the parent process?
–
Wojtek Lerch QNX Software Systems Ltd.
It works ok if I use spawnl(…) rather than spawn(…).
–
Paul.
“Wojtek Lerch” <wojtek_l@ottawa.com> wrote in message
news:9q72pa$627$1@nntp.qnx.com…
Paul Jones <> paul.jones@bnc.ox.ac.uk> > wrote:
I cannot get printf to work from a spawned process. The process is
created
OK and the code for it is very simple (see below)
#include<stdio.h
int main()
{
printf(“This is the spawned process\n”);
return 0;
}
The terminal displays printf messages from the parent process but not
from
the child. What am I doing wrong?
Perhaps something in the parent process? >
–
Wojtek Lerch QNX Software Systems Ltd.
Paul Jones <paul.jones@bnc.ox.ac.uk> wrote:
It works ok if I use spawnl(…) rather than spawn(…).
Could it be that there’s something wrong with how you’re using spawn() then?
(What I’m really trying to say again is that it’s hard to say more
without seeing your code…)
Paul.
“Wojtek Lerch” <> wojtek_l@ottawa.com> > wrote in message
news:9q72pa$627$> 1@nntp.qnx.com> …
Paul Jones <> paul.jones@bnc.ox.ac.uk> > wrote:
I cannot get printf to work from a spawned process. The process is
created
OK and the code for it is very simple (see below)
#include<stdio.h
int main()
{
printf(“This is the spawned process\n”);
return 0;
}
The terminal displays printf messages from the parent process but not
from
the child. What am I doing wrong?
Perhaps something in the parent process? >
–
Wojtek Lerch QNX Software Systems Ltd.
–
Wojtek Lerch QNX Software Systems Ltd.
Paul Jones <paul.jones@bnc.ox.ac.uk> wrote:
I cannot get printf to work from a spawned process. The process is created
OK and the code for it is very simple (see below)
#include<stdio.h
int main()
{
printf(“This is the spawned process\n”);
return 0;
}
The terminal displays printf messages from the parent process but not from
the child. What am I doing wrong?
Probably something in the parent – can you give us the spawn() call?
Most likely something with the fd_count or fd_map parameters.
-David
QNX Training Services
dagibbs@qnx.com