FreeBASIC  0.91.0
dev_scrn_eof.c
Go to the documentation of this file.
1 /* detects EOF for file device */
2 
3 #include "fb.h"
4 
6 {
7  FBSTRING *str;
8  size_t len = 0;
9 
10  str = fb_Inkey( );
11  if( str != NULL )
12  {
13  len = FB_STRSIZE( str );
14  if( (str->data != NULL) && (len > 0) )
15  {
16  DBG_ASSERT(len < sizeof(info->buffer));
17  /* copy null-term too */
18  memcpy( info->buffer, str->data, len+1 );
19  }
20 
21  fb_hStrDelTemp( str );
22  }
23 
24  info->length = len;
25 }
26 
28 {
29  DEV_SCRN_INFO *info;
30  int got_data;
31 
32  FB_LOCK();
33  info = (DEV_SCRN_INFO*) FB_HANDLE_DEREF(handle)->opaque;
34  got_data = info->length!=0;
35  FB_UNLOCK();
36  if( !got_data ) {
37  FB_LOCK();
38  fb_DevScrnFillInput( info );
39  got_data = info->length!=0;
40  FB_UNLOCK();
41  }
42  return !got_data;
43 }