\r
#ifdef WIN32 \r
# include <windows.h>\r
+ int InputWaiting()\r
+ { // checks for waiting input in pipe\r
+ static int pipe, init;\r
+ static HANDLE inp;\r
+ DWORD cnt;\r
+\r
+ if(!init) inp = GetStdHandle(STD_INPUT_HANDLE);\r
+ if(!PeekNamedPipe(inp, NULL, 0, NULL, &cnt, NULL)) return 1;\r
+ return cnt;\r
+ }\r
#else\r
# include <sys/time.h>\r
+# include <sys/ioctl.h>\r
+ int InputWaiting()\r
+ {\r
+ int cnt;\r
+ if(ioctl(0, FIONREAD, &cnt)) return 1;\r
+ return cnt;\r
+ }\r
int GetTickCount() // with thanks to Tord\r
{ struct timeval t;\r
gettimeofday(&t, NULL);\r