Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!mayoff From: mayoff@cs.utexas.edu (Robert Mayoff) Newsgroups: comp.windows.x Subject: Re: Catching xterm i/o in an event loop - a question Message-ID: <979@latexo.cs.utexas.edu> Date: 30 Oct 90 21:48:52 GMT References: <9693@helios.TAMU.EDU> Distribution: usa Organization: Dept of Computer Sciences, UTexas, Austin Lines: 20 In article <9693@helios.TAMU.EDU> antek@bigraf.tamu.edu writes: >I have no idea, it is possible at all: I would like to include "text" i/o >(done by "scanf"or just "getchar") from an xterm screen inside the main events >loop - ie. a user should be able to perform a terminal dialog AND handle >graphics in the same time. This is remarkably similar to a question asked here a week or two ago, about just the same thing. I'll recap what I said then: Build a file-descriptor mask (type fdset if you have it, otherwise just an int) containing stdin (file descriptor 0) and the X socket descriptor (using the ConnectionNumber macro on your Display pointer). Flush the X output buffer with XFlush(). Select for reading on your fd mask. When select() returns, the fd mask will be modified to indicate which descriptors can be read from without blocking. See the man pages for select(2) and ConnectionNumber(3X) for more info. -- /_ rob /_ Fun things to do with UNIX (#12 in a series): / cd /dev; cat mouse # Try this on a Sun. Really!