Path: utzoo!attcan!uunet!aplcen!haven!adm!smoke!brl.mil!moss From: moss@brl.mil (Gary S. Moss (VLD/VMB) ) Newsgroups: comp.windows.x Subject: Re: "wake up" XtAppMainLoop (X <-> C IPC) Keywords: XtAddInput, sockets Message-ID: <14242@smoke.BRL.MIL> Date: 25 Oct 90 18:54:56 GMT References: <9954@uhccux.uhcc.Hawaii.Edu> <12053@ibism.uucp> <1990Oct24.124130.3273@ncsuvx.ncsu.edu> Sender: news@smoke.BRL.MIL Reply-To: moss@brl.mil Organization: Ballistic Research Laboratory Lines: 20 In article <1990Oct24.124130.3273@ncsuvx.ncsu.edu>, george@hobbes.ncsu.edu (George Browning) writes: |> The X interface forks off the child C program and I utilize the above |> piping to capture the output of the C program. However, when an error |> occurs I'd like to pass a message from the C program to the X interface |> telling it to display an error dialog. I did basically what you are trying to do by telling the C program to append errors to a temporary file which I had already opened for writing errors from the front-end X interface. I use fopen to open the file for writing and freopen to open it for reading in the front end, then call XtAppAddInput right before XtAppMainLoop: (void) XtAppAddInput( apcon, fileno(errorfp), XtInputReadMask, displayLogMsg, (XtPointer) errorfp ); displayLogMsg plops the text into an AsciiTextWidget. You could also set up a pipe for the child's stderr to go to which XtAppAddInput would read from as Larry Poleshuck stated in his note. -Gary