FreeBASIC  0.91.0
io_inkey.c
Go to the documentation of this file.
1 /* console INKEY() function */
2 
3 #include "../fb.h"
4 #include "fb_private_console.h"
5 
7 {
8  FBSTRING *res;
9  int key;
10 
11  key = fb_hConsoleGetKey( TRUE );
12 
13  if( key == -1 ) {
14  res = &__fb_ctx.null_desc;
15  } else {
16  res = fb_hMakeInkeyStr( key );
17  }
18 
19  return res;
20 }
21 
22 int fb_ConsoleGetkey( void )
23 {
24  int k = fb_hConsoleGetKey( TRUE );
25  while( k==-1 ) {
26  fb_Sleep( -1 );
27  k = fb_hConsoleGetKey( TRUE );
28  }
29  return k;
30 }
31 
32 int fb_ConsoleKeyHit( void )
33 {
34  return fb_hConsolePeekKey( TRUE ) != -1;
35 }