Message-Id: <3.0.32.19970624034117.00689bbc@mail.geocities.com> Date: Tue, 24 Jun 1997 04:04:56 -0300 To: djgpp AT delorie DOT com From: Guilherme Silveira Subject: A break for everyone Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk Who remember an old Apple? His old CP-400? CP-500? A not so old MSX? Did you ever programmed in LOGO? BASIC? GWBASIC (Basic in portuguese ;) I was thinking about 7 years ago, when I was 8, and my dad show me a CP-400 and a manual for BASIC. I lost my K-7 where was so many games for it. Does anyone remeber the time for K-7? I was looking the post under it when I remembered BASIC Thanks George... Guilherme (15 years old) At 08:44 20/06/1997 GMT, you wrote: >James MacDonald (trill AT Xnetbook DOT demon DOT co DOT uk) wrote: > >: Is it possible to have a three second delay in which time F1 can be >: pressed (like INKEY/INKEY$ in BBC BASIC)? > >How about this: > >#include >#include > >int inkey(int a) >/* IIRC a is measured in centiseconds, so that's what I've done here */ >{ > int start; > if (a<0) > return 0; /* you'd need to use Allegro or similar to do these */ > else { > start=clock(); > while ((!kbhit())&&(clock()-start if (kbhit()) > return (getch()); > else > return 0; /* or was it -1? Can't remember... I think it was 0 for > false though */ > } >} > >I tried this, it seems to work as expected. In C I suppose INKEY and >INKEY$ are pretty much the same. If you're fussy about timing accuracy, >replace clock with uclock in both places and replace CLOCKS_PER_SEC with >UCLOCKS_PER_SEC, but refer to the warnings in the documentation for >uclock. > >-- >George Foot >Merton College, Oxford >