Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C and Linux

Author: Frank Phillips

Date: 13:42:45 04/08/02

Go up one level in this thread


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);



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.