From d3523991af0f66b662db7c5c85cbdc9c1a29914e Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 19 Jul 2015 00:31:31 +0000 Subject: [PATCH] - Flush unused input the right way, i.e. by reading it. - Removed mysterious quarter-second delay at start-up. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@50965 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- test/dos/waitforchar.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/dos/waitforchar.c b/test/dos/waitforchar.c index 5088d1dbd4..1f675a5611 100644 --- a/test/dos/waitforchar.c +++ b/test/dos/waitforchar.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2014, The AROS Development Team. All rights reserved. + Copyright © 1995-2015, The AROS Development Team. All rights reserved. $Id$ */ @@ -7,21 +7,22 @@ int main() { + TEXT ch; BPTR in = Input(); BPTR out = Output(); - SetMode(in, 1); + Printf("Enter a character within 9 seconds:\n"); - Delay(25); + SetMode(in, 1); if (WaitForChar(in, 9000000)) + { FPuts(out, "WaitForChar: char arrived\n"); + Read(in, &ch, 1); /* Flush the character */ + } else FPuts(out, "WaitForChar: timeout\n"); - Flush(in); - Flush(out); - SetMode(in, 0); return 0; -- 2.11.4.GIT