FreeBASIC  0.91.0
file_eof.c
Go to the documentation of this file.
1 /* eof function */
2 
3 #include "fb.h"
4 
5 /*:::::*/
7 {
8  int res;
9 
10  if( !FB_HANDLE_USED(handle) )
11  return FB_TRUE;
12 
13  FB_LOCK();
14 
15  if( handle->hooks == NULL || handle->hooks->pfnEof==NULL ) {
16  FB_UNLOCK();
17  return FB_TRUE;
18  }
19 
20  if( handle->putback_size != 0 ) {
21  FB_UNLOCK();
22  return FB_FALSE;
23  }
24 
25  if( handle->hooks->pfnEof != NULL ) {
26  res = handle->hooks->pfnEof( handle );
27  } else {
28  res = FB_TRUE;
29  }
30 
31  FB_UNLOCK();
32 
33  return res;
34 }
35 
36 /*:::::*/
37 FBCALL int fb_FileEof( int fnum )
38 {
39  return fb_FileEofEx(FB_FILE_TO_HANDLE(fnum));
40 }
41