- Flush unused input the right way, i.e. by reading it.
[AROS.git] / test / dos / waitforchar.c
blob1f675a5611677882f44014f13e3f6cc1a748f0bc
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
8 int main()
10 TEXT ch;
11 BPTR in = Input();
12 BPTR out = Output();
14 Printf("Enter a character within 9 seconds:\n");
16 SetMode(in, 1);
18 if (WaitForChar(in, 9000000))
20 FPuts(out, "WaitForChar: char arrived\n");
21 Read(in, &ch, 1); /* Flush the character */
23 else
24 FPuts(out, "WaitForChar: timeout\n");
26 SetMode(in, 0);
28 return 0;