Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uwm.edu!bionet!agate!ucbvax!osf.org!dbrooks From: dbrooks@osf.org Newsgroups: comp.windows.x.motif Subject: Re: Capturing Stdout/stderr to scrolling window Message-ID: <9103062327.AA02012@penge.osf.org> Date: 6 Mar 91 23:27:38 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 32 mrabin@ADS.COM (Marla Rabin) writes: |> In main, before realizing and main-looping I have the line: |> XtAddInput(fileno(stdin), XtInputReadMask, get_from_input, mainText); |> |> where get_from_input is: |> |> void |> get_from_input(w, fid, id) |> Widget w; |> int *fid; |> XtInputId *id; |> { |> char buf[BUFSIZ]; |> int nbytes, i; |> |> extern void printToMain(); |> |> fprintf(stderr, "in get\n"); |> nbytes = read(*fid, buf, BUFSIZ); ^^^^^^ Assuming the writer hasn't closed the pipe, this will block until enough data is shoved across. You'll have to do whatever SunOS offers to perform a nonblocking read. (Anyway, that's what occurred to me straight away. I haven't looked too closely at the mess of dup and close calls...) -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks "It's not easy, but it is simple."