Author: Robert Hyatt
Date: 14:53:36 04/08/02
Go up one level in this thread
On April 08, 2002 at 16:42:45, Frank Phillips wrote: >It does not work with the cin.rdbuf() command or (of course) polling the >underlying file. I need a replacement for the cin.rdbuf, which I imaged was >some sort of peek command - without taking characters out of the buffer > > > >fd_set rfds; >struct timeval tv; >int retval; > >if (cin.rdbuf()->in_avail() > 1) > return (1); > >FD_ZERO(&rfds); >FD_SET(0, &rfds); >tv.tv_sec = 0; >tv.tv_usec = 0; >retval = select(1, &rfds, NULL, NULL, &tv); >if (retval) > return (1); If you are using C, you want to use "stdin" anyway. If you are using C++, then I am not sure what you have to do there to work around the buffering problem...
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.