antek@bigraf.tamu.edu (10/31/90)
Hi! 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. My problem - as you can see - is, a program may wait for an event OR for <CR> satysfying the "getchar" function. I would like to avoid my "own" terminal emulator - xterm is there, so why to double it? Antek @ Bioch.Tamu.Edu Bitnet: Antek @ Tambigrf
mayoff@cs.utexas.edu (Robert Mayoff) (10/31/90)
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 <mayoff@cs.utexas.edu> /_ Fun things to do with UNIX (#12 in a series): / cd /dev; cat mouse # Try this on a Sun. Really!