Hi all....
I have a c program with a parent and child created using fork() and both do different actions. I want to display the printf statement outputs of two processes in two different terminals. So i tried to open a new terminal using gnome-terminal sing system call. It opens a new terminal but the control is not transferred to new terminal
Meanwhile i tried the xterm commands but am unable to get what i need
What i want to implement is as follows
int main()
{
....
....
pid=fork();
if(pid==0)//child
{
system("COMMAND"); /*COMMAND is command needed to open a new window and display further printf outputs and get fiurther inputs needed by child here after, with parent retaining its control in parent terminal and that should do parent input and outputs in tat parent terminal */
.....
..... //some actions
printf("...."); // This is child's one , so needed to display in new window
getchar(); // wait for user to see displayed results
system("COMMAND"); /* COMMAND is to close the child window or terminal after user seeing displayed results */
}
if(pid>0) //parent
{
....
....
/* The printfs and scanfs here are to be done in parent terminal from where program is executed*/
}
return 0;
}
So I need help in this.
Thanx in advance
Bookmarks